-2

I dont know how to fixe this error

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

my code is

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)) {

I want to update php version of eregi to preg_match and I try this

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)) {
hakre
  • 193,403
  • 52
  • 435
  • 836
New_World
  • 61
  • 7

1 Answers1

0

You forgot the delimiters for the regex, so just change this:

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

to:

if ( preg_match("/" . $patt . "/",$v,$res)) {
Rizier123
  • 58,877
  • 16
  • 101
  • 156