Closed Bug 1632725 Opened 1 year ago Closed 1 year ago

cannot use regular expression to search for string between + and @

Categories

(Core :: JavaScript Engine, defect)

75 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1225665

People

(Reporter: a.liamaan, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36

Steps to reproduce:

let email = "support+account@domain.com"
email.match(/(?<=+)[^.]+(?=@)/gi);

Actual results:

Error: invalid regexp group

Expected results:

should have matched "account"

Lookbehinds are only supported in Chrome
http://kangax.github.io/compat-table/es2016plus/#test-RegExp_Lookbehind_Assertions

Note that the regexp seems to be broken in Chrome too, without escaping the +

let email = "support+account@domain.com"
email.match(/(?<=\+)[^.]+(?=@)/gi);

> ["account"]

Implementation is tracked in bug 1225665. Not sure if duping against that bug is the best choice, in case triagers can fix it.

Status: UNCONFIRMED → RESOLVED
Closed: 1 year ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1225665
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
You need to log in before you can comment on or make changes to this bug.