slevithan/xregexp

Positive lookbehinds not working

john5634 opened this issue · 3 comments

Hello!

Trying to use positive lookbehinds with XRegExp and it does not seem to work.

Is this known?

TRYING TO MATCH: "Empire Burlesque"

WITH:

REGEX:
(?<=<TITLE>)(.*)(?=</TITLE>)

STRING:

<TITLE>Empire Burlesque</TITLE> Bob Dylan USA Columbia 10.90 1985

What browser are you testing it with? Lookbehind should work if and only if you're using a browser / JavaScript runtime that supports regex lookbehind natively.

We are using firefox 67. Which does not support Lookbehinds. We were hoping that XRegExp would enable them?

No, lookbehind is not something XRegExp provides on its own.

For your regex and example string, it seems simple enough to use a regex like this instead:

/<TITLE>(.*?)</TITLE>/

Then just reference the value in capturing group 1, rather than the whole match.