开发者

What's the equivalent of this Javascript regexp in PHP?

开发者 https://www.devze.com 2023-01-24 10:49 出处:网络
I have this js regexp which I need in PHP code now instead: var al开发者_JAVA百科phaExp = /^[a-zA-ZåäöÅÄÖ\\s\\-]+$/;

I have this js regexp which I need in PHP code now instead:

var al开发者_JAVA百科phaExp = /^[a-zA-ZåäöÅÄÖ\s\-]+$/;
if (!fld.value.match(alphaExp)) {
  //ERROR OUTPUT HERE
}

Whats the equivalent to this in PHP?


$string = "åäöÅÄÖ";
$alphaExp = "/^[a-zA-ZåäöÅÄÖ\s\-]+$/";
if(!preg_match($alphaExp, $string)) {
  //ERROR OUTPUT HERE
  echo "ERROR";
}
0

精彩评论

暂无评论...
验证码 换一张
取 消