aseec
V2EX  ›  问与答

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

  •  
  •   aseec · May 3, 2015 · 3375 views
    This topic created in 4053 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   ·   5469 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 49ms · UTC 07:41 · PVG 15:41 · LAX 00:41 · JFK 03:41
    ♥ Do have faith in what you're doing.