Yeah, sometimes it just makes sense to use regex, especially when looking for patterns in text. It's easier to say "look for \([0-9]{3}\) [0-9]{3}\-?[0-9]{4}" than:
look for a ( character, if you find one, check that
the next character matches any of 0, 1, 2, ...
the next character matches any of 0, 1, 2, ...
the next character matches any of 0, 1, 2, ...
the next character is a ) character...
...
...
...
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Yeah, sometimes it just makes sense to use regex, especially when looking for patterns in text. It's easier to say "look for
\([0-9]{3}\) [0-9]{3}\-?[0-9]{4}
" than:(
character, if you find one, check that0
,1
,2
, ...0
,1
,2
, ...0
,1
,2
, ...)
character...