-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
  • 10,350
  • 10
  • 55
  • 79
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
  • 4,732
  • 3
  • 18
  • 34