【发布时间】:2021-08-06 09:56:57
【问题描述】:
我想验证印度手机号码。手机号码格式如下:
9775876662、8156652458、7596658556、6655485568
下面的正则表达式:
function wpcf7_is_tel( $tel ){
$pattern = '%^[+]?' // + sign
. '(?:\([0-9]+\)|[0-9]+)' // (1234) or 1234
. '(?:[/ -]*' // delimiter
. '(?:\([0-9]+\)|[0-9]+)' // (1234) or 1234
. ')*$%';
$result = preg_match( $pattern, trim( $tel ) );
return apply_filters( 'wpcf7_is_tel', $result, $tel );
}
我想改变模式。请帮忙。
【问题讨论】:
标签: php regex wordpress contact-form-7