News for hackers. Stuff that matters.
Re:Regex character "$" doesn't mean "end-of-string" by da39a3ee on Wednesday March 20, 2024 @06:47AM (#39764807)
You don't have to be an expert; you should very rarely be using regexes so complex that you can't understand them.
Re:Regex character "$" doesn't mean "end-of-string" by zacmps on Wednesday March 20, 2024 @07:03AM (#39764895)
It might not be obvious when you hit that point, bad regexes can be subtle, just see that old cloudflare postmortem.
Re:Regex character "$" doesn't mean "end-of-string" by hnlmorg on Wednesday March 20, 2024 @07:55AM (#39765228)
...and if you can understand them then you clearly understand regex enough not to need ChatGPT to write them
Re:Regex character "$" doesn't mean "end-of-string" by kaibee on Wednesday March 20, 2024 @09:30AM (#39766187)
I understand assembly too.
Re:Regex character "$" doesn't mean "end-of-string" by hnlmorg on Thursday March 21, 2024 @06:22AM (#39776787)
The only time you'd want to write assembly in production code would be if you need to hand roll some optimisation. So I don't really understand your point here,
Re:Regex character "$" doesn't mean "end-of-string" by mnau on Wednesday March 20, 2024 @12:39PM (#39768987)
Even simple regexs can be problematic, e.g. Gitlab RCE bug through ExifTools

https://devcraft.io/2021/05/04/exiftool-arbitrary-code-execu...

> "a\ > ""

> The second quote was not escaped because in the regex $tok =~ /(\\+)$/ the $ will match the end of a string, but also match before a newline at the end of a string, so the code thinks that the quote is being escaped when it’s escaping the newline.