Regex can get pretty tricky if you are not careful. I always try to test the results with a online regex tester and a series of test data, of both desired includes and desired excludes. I’m often surprised of what sneaks through in both cases.....
j/k. Back when I programmed a lot of Perl (~8 years ago) I used a lot of regex. Not sure how any real programmer could mistake \s for .* unless it was just an oversight or mistype that wasn't checked. But noone would think, "whitespace" and type ".*" (aka anything and everything)
Agreed. I’ve been writing regex for 20 years and I still surprise myself with undesired results. It’s the nature of the beast.
Any of you guys ever have Regex insert new words that weren’t in the text originally?
>Regex can get pretty tricky if you are not careful. I always try to test the results with a online regex tester and a series of test data, of both desired includes and desired excludes. Im often surprised of what sneaks through in both cases.....
I generally hate regex; there’s always some odd-case that totally breaks it, and they’ll break utterly if there’s a change in the structure and they’re anything more complex than “remove the whitespace” or “remove everything that’s not a digit.” Then there’s always the possibility that you’ll suddenly need (due to the client saying something) balanced parentheses...
I think I’d rather learn SNOBOL than spend the effort to gain any sort of ‘mastery’ over them.