I ran into two problems related to the above when extracting text with delimiters \ and / and found a solution that works for both except using new RegExp , which requires \\\\ at the beginning. This data is in Chrome and IE11.
Regular expression
/\\(.*)\//g
does not work. I think that // interpreted as the beginning of the comment, despite the escape character. Regular expression (equally true in my case, although not in general)
/\b/\\(.*)\/\b/g
doesn't work either. I think the second / terminates the regex despite the escape character.
What works for me is to represent / as \x2F , which is the hexadecimal representation of / . I find this more efficient and understandable than using new RegExp , but of course he needs a comment to identify the hex code.
Ronald Davis Oct 31 '14 at 1:47 2014-10-31 01:47
source share