I encountered two issues related to the foregoing, when extracting text delimited by \
and /
, and found a solution that fits both, other than using new RegExp
, which requires \\\\
at the start. These findings are in Chrome and IE11.
The regular expression
/\\(.*)\//g
does not work. I think the //
is interpreted as the start of a comment in spite of the escape character. The regular expression (equally valid in my case though not in general)
/\b/\\(.*)\/\b/g
does not work either. I think the second /
terminates the regular expression in spite of the escape character.
What does work for me is to represent /
as \x2F
, which is the hexadecimal representation of /
. I think that's more efficient and understandable than using new RegExp
, but of course it needs a comment to identify the hex code.