0

我的以下正则表达式条件适用于 $outputMsg="Center xxx 已更新" 但它在 $outputMsg="Center xxx yyy 已更新" 时不起作用

if(isset($messages->messages['status'])){
       $outputMsg= strip_tags($messages->messages['status'][0]);
       if(preg_match('/^Center [\w\d]+ has been updated.$/', $outputMsg))
       {
           $messages->messages['status'][0]="Centre details successfully updated";
       }
    }

有什么帮助吗?

4

1 回答 1

0

Add a space in your regex, like:

/^Center [\w ]+ has been updated.$/
于 2013-05-13T12:01:33.747 回答