1/4 Reminder: The use of “\” as a regex escape character is causing me problems in a particular programming scenario, explained here: https://www.tbray.org/ongoing/When/202x/2024/09/22/Unbackslashing
-
1/4 Reminder: The use of “\” as a regex escape character is causing me problems in a particular programming scenario, explained here: https://www.tbray.org/ongoing/When/202x/2024/09/22/Unbackslashing
As promised, here is a series of polls to let you, Dear Readers, vote on the “\” replacement, appearing as a comment thread on this post.
1st round has 3 polls. If they’re not here yet when you see this, come back in a bit.
-
2/4 Poll 1 of 3. I want to choose another character to replace “\”, let’s use
“\([^\n\r)]*\)” as an example. -
3/4 Poll 2 of 3. I want to choose another character to replace “\”, let’s use
“\([^\n\r)]*\)” as an example. -
4/4 Poll 3 of 3: I want to choose another character to replace “\”, let’s use
“\([^\n\r)]*\)” as an example. -
That’s all for now. Come back for the playoffs.
-
@timbray What about the back-tick ˋ char? Why excluding it arbitrarily and refusing to give it a chance?
-
@zpqrtbnk Because one of the problems is embedding these things in Go code, where ` is a magic character
-
@timbray I assume "just a string, but we're sticking r in front of it" or the like is not on the table?
-
@TheRealPomax No, the problem is the char \ which has multiple different meanings in different parts of regexes, and also meanings in JSON (the wrapper format) and Go (the programming language) which makes testing painful.
-
@timbray As I hinted before, the problem isn't the character it's the 2**n-1 rule. Change how they work to make them more manageable and the choice of character is far less important.
-
@robpike Yeah, but I can't, because the problem is that the character is meta in regexes *and* Go *and* JSON, and there’s nobody who can change that.