RegEx expression that will capture everything between two characters including multiline blocks

后端 未结 3 1044
迷失自我
迷失自我 2020-12-09 17:22

I want to capture all text & blocks of text between <% and %>.

For example:



Title Here
&l         


        
3条回答
  •  北海茫月
    2020-12-09 17:45

    \<\%(.*?)\%\>. You need to use .*? to get non-greedy pattern matching.

    EDIT To solve the multiline problem, you can't use the . wildcard, as it matches everything except newline. This option differs depending on your regular expressions engine. So, I can tell you what to do if you tell me your regex engine.

提交回复
热议问题