PHP Regular expression matches {"X47x4cx4fx42x41lx53"}

Source: Internet
Author: User
Tags php regular expression
How to match out \x47 \x4c these ASCII characters?
I used to preg_match_all('/\\x(.{2})/i', $str, $matches) match is not out, where the wrong?

Reply content:

How to match out \x47 \x4c these ASCII characters?
I used to preg_match_all('/\\x(.{2})/i', $str, $matches) match is not out, where the wrong?

For $str = "\x47\x4c\x4f\x42\x41L\x53" that $str = "GLOBALS" case, \x47 it is a character that cannot be \x.. matched, but can only match a range, for example [\x00-\xFF] ;
For $str = "\\x47\\x4c\\x4f\\x42\\x41L\\x53" the case, the above code can be used almost, but it should be \\\\ matched with a backslash, escaped through the string, and then escaped by regular.

  • Related Article

    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.