javascript-php Regular removal of Uncode control characters

Source: Internet
Author: User
Tags control characters
The user name verification in the write site, called play penetration friend Test. And then gave me a control character input (although it doesn't matter, but it still has an effect.) It seems that the regular on the SF does not work. Also, how does PHP perl use Uncode?
Test as follows:


  
   

无法匹配(注:u202e 为RLO控制字符)
违禁字符 测试:功轮法
字符序为 RLO功轮法
貌似控制字符钻的空子蛮多?
贴吧已经屏蔽了控制字符,不过,我能力有限,没有找到相关的控制JS的REX。
特来sf求助。
PS:用户名中文没法用 /^[x4e00-x9affw]{4,12}$/

Reply content:

The user name verification in the write site, called play penetration friend Test. And then gave me a control character input (although it doesn't matter, but it still has an effect.) It seems that the regular on the SF does not work. Also, how does PHP perl use Uncode?
Test as follows:


  
    

cannot match (note: u202e is a RLO control character)
Forbidden character test: Power wheel Method
Word Fu She to RLO Falun Method
Seemingly control character drilling is quite a lot of loopholes?
Bar has blocked the control characters, however, I have limited ability to find the relevant control JS Rex.
Special to SF for help.
PS: User name Chinese cannot be used /^[x4e00-x9affw]{4,12}$/

over PHP Manual, found a matching pattern,, Chinese, a-za-z_, Match Regular:
/[wx{4e00}-x{9aff}]{4,12}/u test:

    !--? php $str =json_decode (' "UX this \u202eわかぃまぃだdd");    Var_dump ($STR);    Var_dump (Preg_match ('/^[\w\x{4e00}-\x{9aff}]{4,12}$/u ', $str, $match)); Var_dump ($match);   

Chinese and Japanese should all be OK, to turn on Utf-8 mode.

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 from the UNIX version of PHP 4.1.0 or higher, Win32 version of PHP 4.2.3. PHP 4.3.5 starts checking the utf-8 legitimacy of the pattern.
The problem is over, I don't understand why I didn't answer it.

  • 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.