Match any string between two different tokens

后端 未结 2 1920
情歌与酒
情歌与酒 2021-01-23 19:05

I\'m trying to match a part of a string between two different tokens. They might be multiple occurrences of the tokens in a string.

Sample text (tokens are italic, text

2条回答
  •  后悔当初
    2021-01-23 19:34

    \[begin-match\]((?:(?!\[end-match\]).)*)\[end-match\]
    

    You can try this.See demo.

    https://regex101.com/r/uE3cC4/23

提交回复
热议问题