I need to find those strings:
'555-555-5555'
'(555)555-5555'
I wrote:
number = '(555)555-5555'
regex = ((/^\d{3,3}-\d{3,3}-\d{4,4}$/) | (/^\(\d{3,3}\)\d{3,3}-\d{4,4}$/))
let s = number.match(regex)
But it returns 'null'. I don't understand, how use operator 'or' in regex here?
console.log(regex). You are using the Bitwise OR (|) operator and not alternation