开发者

Grouping regular expressions in a class library? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 11 years ago.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜