Regex to match only innermost delimited sequence

后端 未结 3 1514
感动是毒
感动是毒 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 03:51

    $string = 'do not match this <> not this <> IT HAS CHILDREN>> < this>>';
    @matches = $string =~ /(<<(?:[^<>]+|<(?!<)|>(?!>))*>>)/g;
    

提交回复
热议问题