Regex Escaping Issues
Users discuss problems escaping special characters like backslashes, asterisks, and regex metacharacters in Hacker News comments, often due to markdown rendering for italics and code blocks, while solving regex puzzles or sharing patterns.
Activity Over Time
Top Contributors
Keywords
Sample Comments
Learn this one weird trick to match a backslash!
Character classes would trip you up, I think. e.g. \w for word characters.
They probably need to replace /^[\d\w!@#$%^&*-]$/i with /[^\w\d]/g.
That regex doesn't do what the description above it says, with or without a backslash.
Isn't this what the /s flag is for in your regex? Assuming you are also using /x of course.
Wow, forgot about the \asterisk being a reserved character.
Feature request: a way to escape an asterisk. Sometimes you do want to write a literal asterisk. (E.g. to say "a times b")
At least use a backslash... escape the asterisk and you get sh*t not sht sht.
Bother - forgot that asterisks have a special meaning. Sorry about the formatting.
Did you try to escape your ^ like \^?