1
A previous dev liked to put single statements on the same lines as their relevant if()
s. I'm trying to find these lines now to fix them! I thought that the following regex would find them, but it isn't:
/\^\s*if\.*;\$
/ Start search
\^ Beginning of line
\s* Any amount of whitespace
if Beginning of the if() statement
\.* Any amount of characters
; The end of the single statement
\$ End of the line
So, where did I go wrong?
1Beginning of the line is simply
^
, not\^
. Similarly, end of the line is simply$
. – garyjohn – 2012-08-08T15:55:43.573Thanks. The line
/^\s*if\.*;$
isn't finding any patterns, either. – dotancohen – 2012-08-08T15:58:05.3971
.
is a metacharacter meaning any character.\.
matches only a literal.
. Your code probably does not containif.
literally – RedGrittyBrick – 2012-08-08T15:59:25.443Thank you garyjohn and RedGrittyBrick! That solved it! Please post that as an answer so that I could accept it. Thanks! – dotancohen – 2012-08-08T16:01:45.173