I have a regex which has optional anchors at the end e.g.
(\\.|,|\\/)
I am trying to add \")\" to this but if I escape it
Your regex should look like this:
(\.|,|\/|\))
Test it out with http://rubular.com/
If you want to match one of a set of character, it's best to use a character class. And within such a class, most escaping rules don't apply.
So to match a dot, comma, slash or closing parenthesis, you can use
[.,/)]
\)
is the correct way for escaping a paranthesis. Make sure you are properly escaping the \
(\\
) in the string literal.