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 expression that is good for preg_match
;
~^([p{L}-s']+)$~ui <--- working fine with preg_match
I need the équivalent for JavaScript Regex
I have a lot of hard time figuring it out and nothing works.
Ex;
Jean-Fran?ois d'abiga?l passes with ~^([p{L}-s']+)$~ui
Preg_match
I need the Regex version of it.
Also would like a version for PHP Preg_match
and JavaScript Regex
that would accept the same thing but with numbers [0-9]
.
EDIT
var re = /~^([p{L}-s']+)$~/i; <----- Not working at all
if (re.test(value) == true){
// it passes regex
}
else{
// it does not
}
String example ;
- à_wéird_Us0r-Nam3 <--- Unicode with A-Z àé???.... 0-9 -_’' Regex + Pregmatch
- étiène Bo?s d'autêgne <--- Same but no _ or numbers for Regex
Help would be much appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…