For correction, $ aaabbb is changed to aaabbb 1. for example: $ Table = Channel
Change $ Table = Channel
2 for example $ Row = 10
Change $ Row = 10
3 for example $ Table = Channel
Change $ Table = Channel
Structure Description
The original structure must be There may be spaces or none on the left of the end (>). the parts inside the structure will not change.
Correction
I wrote one myself but it was not perfect.
$ P = '/\ $ (\ w +) = (\ w +)/I ';
$ R = '$1 = "$2 "';
$ C = preg_replace ($ p, $ r, $ c );
The Where = [FatherID] = 0 part cannot be matched or Internal
Matching the entire section of the above three examples
Reply to discussion (solution)
$ SQL = select * from [{pre} Content] where [cid] in (3, 4, 5)
There is no boundary. you cannot judge this. add 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"$3"$4', '$1$2"$3"$4', '$1$2"$3$4"$5', '$1$2"$3"$4', '$1$2"$3"$4'), $s);?>
$ Table = Channel
$ Row = 10
$ Table = Channel
$ SQL = select * from [{pre} Content] where [cid] in (3, 4, 5)
There is no boundary. you cannot judge this. add 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"$3"$4', '$1$2"$3"$4', '$1$2"$3$4"$5', '$1$2"$3"$4', '$1$2"$3"$4'), $s);?>
$ Table = Channel
$ Row = 10
$ Table = Channel
I have an idea. can you improve the semicolon?
You can use $ aa = bb $ to separate them.
First The middle part is proposed.
Add $ at the end and then split it.
$ Row = 10 $ table = Channel $ Where = [FatherID] = 0 $
Can you improve it? thank you.
You have to make sure that there is a $ at the end. you have come up with all your ideas, and it is not difficult to use my changes.
Come on.
In fact, because $ SQL does not have an ending sign, it requires extra points. other functions have been implemented.