Regex to match only innermost delimited sequence

后端 未结 3 1494
感动是毒
感动是毒 2021-01-14 03:16

I have a string that contains sequences delimited by multiple characters: << and >>. I need a regular expression to only give me the

3条回答
  •  不知归路
    2021-01-14 04:10

    @matches = $string =~ /(<<(?:(?!<<|>>).)*>>)/g;
    

    (?:(?!PAT).)* is to patterns as [^CHAR]* is to characters.

提交回复
热议问题