|Just another Perl shrine|
Re: Regex Critic?by LanX (Chancellor)
|on Nov 18, 2013 at 21:30 UTC||Need Help??|
Not that easy.
There are different categories of "bad practice" like unmaintainable code or dangerous code.
It's possible to built little regexes which run for years just b/c backtracking goes exponential in Perl but not in egrep.
So this depends on the engine used and involved optimization. (that much about "static analyzer for several languages")
At the same time the code you showed m/^.*blah.*$/ might be odd but not necessarily slower, cause AFAIK will Perl first try to find the string "blah" somewhere, before continuing.
And it's NOT IDENTICAL to m/blah/ cause multilines wouldn't match w/o /s modifier.
So what's the recommended best practice here in your opinion?
Regarding analyzers, you might be interested in this recent discussion, which had pointers to different projects and older discussions:
( addicted to the Perl Programming Language)