Skip to content

Regex formatting #408

Answered by TrianguloY
PabloOQ asked this question in Q&A
Jan 5, 2025 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

I don't remember any discussion, but maybe an old one exists somewhere.

As for the actual question, the answer is: there is only a single way. Java regex doesn't require you to escape the forward slash '/' but some other languages like JavaScript need it, so probably the url cleaner catalog authors did it just in case. In a regex, writing foo/bar is the same as foo\/bar. Then, the json editor requires the regex to be a string inside, and even though you don't need to escape the slashes, and "foo/bar" is perfectly valid, you can do so if you want which means that "foo\/bar" and "foo\\\/bar" are also valid and represent the same.

So basically: all three ways / \/ and \\\/ represent the same /

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@PabloOQ
Comment options

PabloOQ Jan 5, 2025
Collaborator Author

Answer selected by PabloOQ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants