0

I wrote a regex, which works fine in Chrome, but not in IE 11 and Edge.

 /(?<=MERGEFIELD\s\\plain\\f0\\fs24\s)([a-z]*_[0-9]*)(?=})/g

IE 11 gives me the error: "Unexpected quantifier". I tried with blackslash before ? (\?). The error does not appear, but the Regex does not work either.

Stefan
  • 1
  • 2
  • it doesn't work with Edge either – Stefan Aug 08 '18 at 13:56
  • Chrome is going above and beyond in this case. This would have failed in Firefox too, due to your lookbehind. See this question: https://stackoverflow.com/q/3569104 – Gary Aug 08 '18 at 14:18
  • I got it. I changed my regex in /MERGEFIELD\s\\plain\\f0\\fs24\s([a-z]*_[0-9]*)}/g. I've put the part I'd like to get in paranthesis. ([a-z]*_[0-9]*). After this I use .match to get the array of strings: str.match(basicRtfPattern) This returns not only the part in the paranthesis, but the whole MERGEFIELD tag. Is there a way to obtain only the part in brackets? – Stefan Aug 08 '18 at 14:32
  • I managed this: I get all occurencies with the g constructor. After this I loop the resulting array with the same regexp but without g at the end. – Stefan Aug 08 '18 at 15:03
  • Possible duplicate of [React-Native: JavaScript regular expression exception (Invalid group) on release mode](https://stackoverflow.com/questions/51367051/react-native-javascript-regular-expression-exception-invalid-group-on-release) – Anonymous Aug 09 '18 at 12:44

0 Answers0