How to count regular expressions used in source code files?
If we consider a regular expression delimited by " " in X programming language, is there a way to count or get an estimate of how many expressi开发者_如何学Goons used as regular expressions contains a code base (this is source code in several files in different directories)?
That all depends on your definition of a regular expression ofcourse.
This is a valid regular expression: stackoverflow
, so by that definition just count the amount of words (delimited by " " in your case) and you're done
I don't see why this is relevant, but:
If the regex is just a string delimited by ""
then I would say NO.
If you have e.g. .NET then you can count the new Regex
. But there are still static functions where you don't need to create a Regex object, then same problem as above ...
for X programming language, no. But if you work for a specific programming language you can always look for operators, functions and objects that are used for regex operations.
精彩评论