Grouping regular expressions in a class library? [closed]
I know this is probably personal preference, but what is your preferred method of grouping regular expressions. Do you just have one class with all开发者_开发问答 regular expressions or do you separate them out by type (strings, numbers, etc) or something like by usage (emails, phone, ssn)
I like to keep them close to where they are used, as private static members of the using class.
If you have to update them a lot such as for a parser where you don't control the input data then maybe you group them so that it is easy to do updates, otherwise as was said I just keep them in the classes I use them in.
精彩评论