News for hackers. Stuff that matters.
Re:Regex character "$" doesn't mean "end-of-string" by amelius on Wednesday March 20, 2024 @11:55AM (#39768340)
In theory yes, in practice no.

What you have gained is that the regex is now much easier to read.

Re:Regex character "$" doesn't mean "end-of-string" by knome on Wednesday March 20, 2024 @12:35PM (#39768920)
It's easy to read now.
Re:Regex character "$" doesn't mean "end-of-string" by LK5ZJwMwgBbHuVI on Wednesday March 20, 2024 @01:44PM (#39769828)
> In theory yes, in practice no.

That's like "in theory we need 4 bytes to represent Unicode, but in practice 3 bytes is fine" (glances at universally-maligned utf8mb3)

Re:Regex character "$" doesn't mean "end-of-string" by int_19h on Wednesday March 20, 2024 @06:28PM (#39772773)
It's not really an issue if the string you're matching might have those characters. It's an issue if the regex you are matching that string might need to match those characters verbatim. Which is actually pretty common with ()[]$ when you're matching phone numbers, prices etc - so you end up having to escape a lot, and regex is less readable especially if it also has to use those same characters as regex operators. On the other hand, it would be very uncommon to want to literally match, say, ⦑⦒ or ⟦⟧.