Php 如何像这样在preg_match上添加逗号
这是我的示例preg_match和working,但是如何在代码中添加逗号“,”已经像下面这样了Php 如何像这样在preg_match上添加逗号,php,Php,这是我的示例preg_match和working,但是如何在代码中添加逗号“,”已经像下面这样了 $content = explode(" ",$title); $result = ""; foreach($content as $value){ if(!preg_match("/\.|'/",$value)){ $find = mysqli_query($db, "select * from table where column1='$value'"); $j = mysql
$content = explode(" ",$title);
$result = "";
foreach($content as $value){
if(!preg_match("/\.|'/",$value)){
$find = mysqli_query($db, "select * from table where column1='$value'");
$j = mysqli_num_rows($find);
if($j>0){
$ka = mysqli_fetch_array($find);
$result = $result.$ka['column2'];
}else{
$find2 = mysqli_query($db, "select * from table where column2='$value'");
$j2 = mysqli_num_rows($find2);
if($j2>0){
$ka2 = mysqli_fetch_array($find2);
$result = $result.$ka2['column1']);
}else{
$result = $result.$value;
}
}
}else{
}
我只是试着这样做,但不起作用
if(!preg_match("/\.\,|'/",$value)){
blablabla
}else{
blablabla
}
因为我仍然在学习php,所以不知道该做什么,谢谢如果有人想帮助我,我想你想匹配一个字符列表,请使用字符类
[]
:
if(!preg_match("/[.,']/",$value)){
blablabla
}else{
blablabla
}
学习正则表达式是无价的,仔细阅读它,它将在一个月内为自己买单 一个例子,你想要什么ot匹配将是有帮助的确定我将编辑完整的样本,只需要绕过爆炸和如何放置空间?就像这个preg_匹配(“/[,'\s]/”,$value)