- 1
Phone Number Validator Why add â$â?
https://code.sololearn.com/cvy2GaWHcdSP/?ref=app Why does not adding the â$â Regex cause my code to not pass the third case?
2 Answers
+ 2
"^" and "quot; acts as anchors. For the beginning or end. Without them, regex match will search the entire string after the matching pattern. So "haha10000000" would be valid.
+ 1
BTW, why the vertical bars in the first part of the pattern? If you need to match a set of chars, put only those chars between brackets. With the bars, it will match 1, |, 8, -| or 9.