loading...

re: Basic RegEx in Javascript for beginners 🔥 VIEW POST

TOP OF THREAD FULL DISCUSSION
re: (?(\d{3})?)-.-. - in this example it means it can match 903-455-2346 (657)-878-9065 234.345.5676 (657)-878-9065 That means the (..) can appear 0 ...
 

As You wrote in above comment:
"That means the (..) can appear 0 or 1"

So this is 0 or 1 (NONE or ONE) not "zero or MORE" (as in article).
In article, there is info, that "?" could be zero or more. For me, ie "5" is one of "more" ;)

So I think, in article it should be:
* : 0 or more
+ : 1 or more
? : 0 or 1

Because in current version, there is no difference between "*" and "?"

Yes, Jakub. I update the article a few days ago.
Thank you for pointing out the error.

Code of Conduct Report abuse