const separator = ',';
const escape = '\';
const escapeForRegEx = '\\';
const matchUnescapedSeparatorAndTrim = new RegExp(`\s*(?<!${escapeForRegEx})${separator}\s*`, 'g');
const matchSeparator = new RegExp(separator, 'g');
const matchEscapedSeparator = new RegExp(`${escapeForRegEx}${separator}`, 'g');
Which is throwing an error only on Safari.
SyntaxError: Invalid regular expression: invalid group specifier name
So, I read that Safari doesn’t support lookbehind yet, but I am not sure where is it in my Regex.
How do I fix that?
Also, is there anything wrong with the regex itself or it’s just the way Safari reads it?
Thanks.