The dangers of single line regular expressions
41–50 of 133 posts
[flagged]
Re: The dangers of single line regular expressions
#42[flagged]
Re: The dangers of single line regular expressions
#43[flagged]
Re: The dangers of single line regular expressions
#44[flagged]
Re: The dangers of single line regular expressions
#45[flagged]
Re: The dangers of single line regular expressions
#46[flagged]
Re: The dangers of single line regular expressions
#47[dead]
Re: The dangers of single line regular expressions
#48[dead]
Re: The dangers of single line regular expressions
#49In my experience `$` does reliably mean end of string for regular expressions, unless you specifically ask for "multiline" mode. Ruby seems to be in multiline mode all the time? $ python -c 'import re; print "yes" if re.match(r"^[a-z ]+$", "foobar") else "no"' yes $ python -c 'import re; print "yes" if re.match(r"^[a-z ]+$", "foo\nbar") else "no"' no $ python -c 'import re; print "yes" if re.match(r"^[a-z ]+$", "foo\…
False. "$" does NOT mean end-of-string in Perl, Python, PHP, Ruby, Java, or .NET. In particular, a trailing newline (at least) is accepted in those languages.
A $ does mean end-of-string in Javascript, POSIX, Rust (if using its usual package), and Go.
I'm working with the OpenSSF best practices working group to create some guidance on this stuff. It's a very common misconception. Stay tuned.
If anyone knows of vulnerabilities caused by thus, let me know.
Re: The dangers of single line regular expressions
#50[dead]