1 For example $table =channel
Become $table =channel
2 For example $Row =10
Become $Row =10
3 For example $table =channel
Become $table =channel
Structure description
The original structure must be End (the left side of > may or may not exist) the part within this structure does not change
To seek the regular
I wrote one, but it wasn't perfect.
$p = '/\$ (\w+) = (\w+)/I ';
$r = ' $1= ';
$c = Preg_replace ($p, $r, $c);
The where=[fatherid]=0 section cannot be matched to determine if the Internal
Can match the above three examples to all points
Reply to discussion (solution)
$SQL =select * FROM [{pre}content] where [CID] in (3,4,5)
This does not have the demarcation symbol, cannot judge, finally adds a semicolon
$table =channel
$Row =10
$table =channel '; Echo preg_replace ( Array ('/(<.*) \$ (row= (\d+) (.*>)/', '/(<.*) \$ (table=) (\w+) (.*>)/', '/(<.*) \$ (where=) (\[\w+\]=) (\d+) (.*>)/', '/(<.*) \ $ (type=) (\w+) (.*>)/', '/(<.*) \$ (sql=) (. *;) (.*>)/'), array (' $1$2 ' $ "$4 ', ' $1$2 ' $" $4 ', ' $1$2 ' $3$4 "$" , ' $1$2 ' $ "$4 ', ' $1$2 '" $ $4 '), $s);? >
$table =channel
$Row =10
$table =channel
$SQL =select * FROM [{pre}content] where [CID] in (3,4,5)
This does not have the demarcation symbol, cannot judge, finally adds a semicolon
$table =channel
$Row =10
$table =channel '; Echo preg_replace ( Array ('/(<.*) \$ (row= (\d+) (.*>)/', '/(<.*) \$ (table=) (\w+) (.*>)/', '/(<.*) \$ (where=) (\[\w+\]=) (\d+) (.*>)/', '/(<.*) \ $ (type=) (\w+) (.*>)/', '/(<.*) \$ (sql=) (. *;) (.*>)/'), array (' $1$2 ' $ "$4 ', ' $1$2 ' $" $4 ', ' $1$2 ' $3$4 "$" , ' $1$2 ' $ "$4 ', ' $1$2 '" $ $4 '), $s);? >
$table =channel
$Row =10
$table =channel
I have a train of thought. See if you can improve the semicolon.
You can use the $AA =BB $ to split
first Middle Part of the proposed
at the end of the add $ and then split
$Row =10 $table =channel $Where =[fatherid]=0 $
So you see can be improved under Thank you
you have to make sure there is a $ to go, thinking you have come up with my change is not difficult.
Refueling.