aseec
V2EX  ›  问与答

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

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

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