RadishWind
V2EX  ›  问与答

PHP / Python 如何批量匹配正则表达式?

  •  
  •   RadishWind · Apr 7, 2017 · 3246 views
    This topic created in 3406 days ago, the information mentioned may be changed or developed.

    我在写一个功能型的聊天机器人,想用正则提取用户所说的关键词:

    例如 [ '\d+' => deal_num(), '\w+' => deal_word() ] 请问有没有比遍历数组更好的办法?

    2 replies    2017-04-08 07:11:54 +08:00
    hikkikuma1991
        1
    hikkikuma1991  
       Apr 7, 2017
    ac 自动机
    RadishWind
        2
    RadishWind  
    OP
       Apr 8, 2017 via iPhone
    @hikkikuma1991 💡谢谢!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4121 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 00:05 · PVG 08:05 · LAX 17:05 · JFK 20:05
    ♥ Do have faith in what you're doing.