I am writing some regex to my app. But I got some problem to rewrite regex from https://regexr.com to javascript code. In regexer my regex works fine. But in JS it does not.
I am aware that, I have to escape some special characters in regex, but in this case I misunderstand something.
val.toString().match("^\+?(\(\d{2,4}\))?(?!.*([ -])\\2)[0-9- ]*$") !== null;