I need to convert this PHP flavoured Regex:
(?<=\A|\;#)(.*?)(?=\;#|\z)
Into Javascript flavoured Regex.
I keep on getting unidentified token error while using the existing PHP version in my code.
Appreciate the help.
I need to convert this PHP flavoured Regex:
(?<=\A|\;#)(.*?)(?=\;#|\z)
Into Javascript flavoured Regex.
I keep on getting unidentified token error while using the existing PHP version in my code.
Appreciate the help.
JavaScript doesn't support lookbehinds, nor are \A and \z anchors.
You don't really even need a lookarounds in that regex. You could just use a non-capturing group, and then access the first capture group. Use ^ instead of \A, and $ instead of \z. You also don't need to escape the ;.
(?:^|;#)(.*?)(?:;#|$)
And then use the value in the first capture group.