Regex to find all possible occurrences of text starting and ending with ~

后端 未结 2 517
情歌与酒
情歌与酒 2021-01-12 20:59

I would like to find all possible occurrences of text enclosed between two ~s.

For example: For the text ~*_abc~xyz~ ~123~, I want the foll

2条回答
  •  礼貌的吻别
    2021-01-12 21:52

    Try this [^~\s]*

    This pattern doesn't consider the characters ~ and space (refered to as \s).

    I have tested it, it works on your string, here's the demo.

提交回复
热议问题