-2

このエラーを修正する方法がわかりません

 Warning: preg_match(): Unknown modifier '[' in 

私のコードは

while(list($k,$v)=each($con2)) {
    $patt="($this->block_start_word|$this->block_end_word)[[:blank:]]*([0-9a-zA-Z\_]+)[[:blank:]]*$this->block_end_delim(.*)";
    if (eregi($patt,$v,$res)) {

eregi の php バージョンを preg_match にアップデートしたいので、これを試してみます

hile(list($k,$v)=each($con2)) {
    $patt="($this->block_start_word|$this->block_end_word)[[:blank:]]*([0-9a-zA-Z\_]+)[[:blank:]]*$this->block_end_delim(.*)";
    if ( preg_match($patt,$v,$res)) {
4

1 に答える 1

0

正規表現の区切り文字を忘れたので、これを変更してください:

if ( preg_match($patt,$v,$res)) {

に:

if ( preg_match("/" . $patt . "/",$v,$res)) {
于 2015-01-15T21:50:50.173 に答える