Regular Expression, Select word between two words

前端 未结 3 921
青春惊慌失措
青春惊慌失措 2021-02-04 15:57

I\'m reallllly new to regex and I need some help. I tried figuring out myself but had no luck!

I am trying to select text between 2 strings (character for the last strin

相关标签:
3条回答
  • 2021-02-04 16:07

    This should work if you get the first group:

    \w+\s*(.+)\s*:
    0 讨论(0)
  • 2021-02-04 16:09

    another alternative is to use this pattern

    (?<=word\s).*(?=\s:)
    

    See Lookahead and Lookbehind Zero-Width Assertions

    0 讨论(0)
  • 2021-02-04 16:24

    /word (.*?) \:/ this should do the trick

    0 讨论(0)
提交回复
热议问题