azuginnen
V2EX  ›  问与答

纯匹配中文怎么做呀?求大神指教

  •  
  •   azuginnen · Jul 8, 2014 · 2607 views
    This topic created in 4370 days ago, the information mentioned may be changed or developed.
    今天遇到一个问题,从一个大文本里面去匹配所有中文,遇到不是单字的中文再去处理。

    问题是,这个文本没有什么结构的,我去找中文没有什么锚点可以供我参考(不然正则表达式就好夹出来了),我只好硬去抓中文字符串。

    用perl的话查到一些中文的正则表达式 比如 /[\u41-\u7a]/ [\x80-\xff\w] 等等。
    我的理解是查unicode码表,去夹取一个范围。

    想请教一下大家还有没有更好的实现思路。或者我的思路不对?

    文本格式形如:
    http://code.bulix.org/wbpm1e-86500
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3683 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 04:24 · PVG 12:24 · LAX 21:24 · JFK 00:24
    ♥ Do have faith in what you're doing.