-1

I have this PHP regex:

/^[\p{L}\p{M}]+[\p{L}\p{M}\-\s]*$/u 

and I want to convert it to jQuery. I tried multiple solutions that I found online, but nothing really worked. I tried using

new RegExp("/^[\p{L}\p{M}]+[\p{L}\p{M}\-\s]*$/u"); 

but that didn't help.

Rui Jarimba
  • 11,166
  • 11
  • 56
  • 86
Alex
  • 11
  • 3

1 Answers1

-1

This is because \p{L} and \p{M} don't exist in the JavaScript RegEx engine. This answer provides solutions for matching Unicode categories: https://stackoverflow.com/a/26659285/1920035

David
  • 5,877
  • 3
  • 23
  • 40