RadishWind
V2EX  ›  问与答

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

  •  
  •   RadishWind · Apr 7, 2017 · 3212 views
    This topic created in 3380 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   ·   2917 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 141ms · UTC 14:46 · PVG 22:46 · LAX 07:46 · JFK 10:46
    ♥ Do have faith in what you're doing.