I want a regex that matches a square bracket [. I haven't found one yet. I think I tried all possibilities, but haven't found the right one. What is a valid regex for this?
I want a regex that matches a square bracket [. I haven't found one yet. I think I tried all possibilities, but haven't found the right one. What is a valid regex for this?
How about using backslash \ in front of the square bracket. Normally square brackets match a character class.
Are you escaping it with \?
/\[/
Here's a helpful resource to get started with Regular Expressions:
In general, when you need a character that is "special" in regexes, just prefix it with a \. So a literal [ would be \[.