chuxuezhe
V2EX  ›  问与答

求正则表达式

  •  
  •   chuxuezhe · Sep 22, 2015 · 2525 views
    This topic created in 3913 days ago, the information mentioned may be changed or developed.

    字符串如下
    key: 5_53;E(g5g5rdd[w&Pygg As

    需要正则匹配 key: 和 As 中间的,除了空格什么字符都有可能出现
    求正则表达式

    6 replies    2015-09-22 14:28:23 +08:00
    explon
        1
    explon  
       Sep 22, 2015
    按照空格分割成数组取 key: 与 As 之间的不就好了?
    chuxuezhe
        2
    chuxuezhe  
    OP
       Sep 22, 2015
    两头还有其他的单词
    suduo1987
        3
    suduo1987  
       Sep 22, 2015 via iPhone
    代码混淆?
    aa45942
        4
    aa45942  
       Sep 22, 2015
    (?<=^key:).*(?=As$)
    b821025551b
        5
    b821025551b  
       Sep 22, 2015
    key:(.*)As
    freedomSky
        6
    freedomSky  
       Sep 22, 2015
    key: \([^ ]*\) As
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3208 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 13:49 · PVG 21:49 · LAX 06:49 · JFK 09:49
    ♥ Do have faith in what you're doing.