aseec
V2EX  ›  问与答

正则表达式 如何匹配任意 中文标题?

  •  
  •   aseec · May 3, 2015 · 3474 views
    This topic created in 4102 days ago, the information mentioned may be changed or developed.
    类似 “壹贰叁,abc, 肆伍陆?”
    4 replies    2015-05-03 20:55:50 +08:00
    chengzhoukun
        1
    chengzhoukun  
       May 3, 2015
    [\u4e00-\u9fa5]?
    shiny
        2
    shiny  
    PRO
       May 3, 2015
    http://php.net/manual/zh/regexp.reference.unicode.php

    <?php
    preg_match("/\p{Han}+/u", 'test中文', $result);
    var_dump($result);
    lsmgeb89
        3
    lsmgeb89  
       May 3, 2015
    aseec
        4
    aseec  
    OP
       May 3, 2015
    中间的逗号怎么匹配,试过\w * 都没成功
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5079 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 09:46 · PVG 17:46 · LAX 02:46 · JFK 05:46
    ♥ Do have faith in what you're doing.