Positive lookahead doesn't stop at first occurrence

后端 未结 1 363
我寻月下人不归
我寻月下人不归 2021-01-04 07:24

I use the regex

(?<=Charset:\\s).+(?=) 

on the following data (There is no newline char in the data, I made it look better

1条回答
  •  孤独总比滥情好
    2021-01-04 07:51

    An easy way is to use the non-greedy operator.

    (?<=Charset:\s).+?(?=)
    

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