Javascript-PHP regular expression removes the regular expression of uncode control characters

Source: Internet
Author: User
Tags control characters php regular expression
The user name verification on the website is called a friend Test of playpenetration .. Then let me enter a control character (although it does not matter, it still has an impact. It seems that the regular expression on sf does not work either. Also, how does PHPperl use uncode? The following test: {code...} cannot match (... the user name verification on the website is written, called the friend Test of playpenetration .. Then let me enter a control character (although it does not matter, it still has an impact. It seems that the regular expression on sf does not work either. Also, how does PHP perl use uncode?
Test as follows:


  

Unable to match (note: u202e is the RLO control character)
Test prohibited characters: Rotation method
The collation isRLORotation method
Does it seem like there are a lot of characters to control?
The post has blocked control characters. However, I have limited capabilities and have not found relevant control JS REX.
Come to sf for help.
PS: the user name cannot be used in Chinese /^[x4e00-x9affw]{4,12}$/

Reply content:

The user name verification on the website is called a friend Test of playpenetration .. Then let me enter a control character (although it does not matter, it still has an impact. It seems that the regular expression on sf does not work either. Also, how does PHP perl use uncode?
Test as follows:


   

Unable to match (note: u202e is the RLO control character)
Test prohibited characters: Rotation method
The collation isRLORotation method
Does it seem like there are a lot of characters to control?
The post has blocked control characters. However, I have limited capabilities and have not found relevant control JS REX.
Come to sf for help.
PS: the user name cannot be used in Chinese /^[x4e00-x9affw]{4,12}$/

After turning over PHP Manual, we found the matching mode, which is Chinese, a-zA-Z _, matching the regular expression:
/[wx{4e00}-x{9aff}]{4,12}/uTest:


    

There should be no problem with Chinese and Japanese. we need to enable the UTF-8 mode.

In UTF-8 mode, "x {...}" Allowed. the content in curly braces is a hexadecimal valid number. It interprets the given hexadecimal number as a UTF-8 character code.

U (PCRE_UTF8)
This modifier opens an additional feature that is incompatible with perl. The pattern string is considered to be UTF-8. This modifier is available for php 4.1.0 or later in unix and php 4.2.3 In win32. Php 4.3.5 starts to check the validity of the UTF-8 mode.
The question is over. I don't understand why I didn't answer much.

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.