Noticed small error on RegExp object page

RESOLVED WORKSFORME

Status

Developer Documentation
General
P5
normal
RESOLVED WORKSFORME
2 years ago
2 years ago

People

(Reporter: jmcilhargey, Unassigned, NeedInfo)

Tracking

Details

(URL)

(Reporter)

Description

2 years ago
:: Developer Documentation Request

      Request Type: Correction
     Gecko Version: unspecified
 Technical Contact: 

:: Details

This code sections shows the ways to call the RegExp constructor to create a new object

/ab+c/i;
new RegExp('ab+c', 'i');
new RegExp(/ab+c/, 'i');

I found this part "new RegExp(/ab+c/, 'i');" will throw "TypeError: Cannot supply flags when constructing one RegExp from another." I believe the correct syntax for this format is to include the flag on the end of the regex. In this case, "new RegExp(/ab+c/i);"

Comment 1

2 years ago
Hi, 

I tried to reproduce the TypeError but everything works fine for me. 

Can you please provide more information?
Flags: needinfo?(jmcilhargey)
Yes, it worked for me too, I'm marking this as RESOLVED. jmcilhargey, feel free to reopen with more context if we are wrong!
Status: UNCONFIRMED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.