I created this pattern in java, and now I’m trying to use it in javascript. Why am I getting this error?
var pattern = /b(?=[A-Z\d]{9,10}\b)(?:[A-Z]*\d){0,2}[A-Z]*/b;
SyntaxError: invalid regular expression flag b
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Are you trying to use “word boundaries”? That would be
\b(notice the direction of the slash).You also need
//as delimiters.