Relative Content

Tag Archive for javascriptregex

Regex is matching when it is not supposed to be matching

const regex1 = /(1( )?)?(d{3})2d{3}-d{4}/; Javascript.
for those who know regex. I want to check if 1 (555)555-5555 is matched but it is not supposed to be matched. Because the first delimiter is backreferenced, so the second delimiter should be equal to the first one but in my case, it is not. Why is it still returning true? Does anybody know?