Preg_match to regex equivalent expression

前端 未结 2 1790
旧时难觅i
旧时难觅i 2020-11-30 15:39

I am stuck on preg_match vs regex

I am trying to verify user input value on client side. For their first and last name i have this expressi

2条回答
  •  独厮守ぢ
    2020-11-30 16:11

    This was clearly not a duplicate!

    Found this here that helped.

    I found the solution;

    /^[a-zA-Z0-9\u00C0-\u017F\s-'’]+$/
    

    This line will only accept diacritics, letters, numbers, space, -,',’ Wich was exactly what i needed.

    I just have to remove the numbers and it will be good for my names as well.

提交回复
热议问题