Correction: $ aaa = bbb to aaa = "bbb"

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.