How to non-greedy multiple lookbehind matches

后端 未结 3 1732
南方客
南方客 2020-12-17 06:49
Source:    
Engine:    PCRE

RegEx1:    (?<=)(.*)(?=

        
3条回答
  •  不思量自难忘°
    2020-12-17 07:25

    Put something greedy in front of it?

    (?:.*)(?<=)(.*)(?=)
    

    Since the greedy (?:.*) will gobble as much as it can, only the minimum will be matched by the rest of the pattern - effectively making the rest non-greedy.

    The non-greedy .*? might also work:

    (?<=)(.*?)(?=)
    

提交回复
热议问题