Whats the regex for
xxx-xxx-xxxx
or
(xxx)xxx-xxxx
I can create regex for the first one with
/^\d{3}-\d{3}-\d{4}$/
but how to add rule in this so it can also handle the second one?
Answer
You can use this: -
/^(?:\(\d{3}\)|\d{3}-)\d{3}-\d{4}$/
Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...
No comments:
Post a Comment