RadishWind
V2EX  ›  问与答

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

  •  
  •   RadishWind · Apr 7, 2017 · 3400 views
    This topic created in 3514 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
    hikkikuma1991
    Apr 7, 2017
    1
    ac 自动机
    RadishWind
    RadishWind
    OP
    Apr 8, 2017 via iPhone
    2
    @hikkikuma1991 💡谢谢!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1856 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 01:01 · PVG 09:01 · LAX 17:01 · JFK 20:01
    ♥ Do have faith in what you're doing.