Regex not stopping at first space

后端 未结 5 1750
说谎
说谎 2021-01-05 03:20

Trying to create a pattern that matches an opening bracket and gets everything between it and the next space it encounters. I thought \\[.*\\s would achieve th

5条回答
  •  一整个雨季
    2021-01-05 03:47

    You could use a reluctant qualifier:

    [.*?\s
    

    Or instead match on all non-space characters:

    [\S*\s
    

提交回复
热议问题