I want to capture all text & blocks of text between <% and %>.
For example:
<html>
<head>
<title>Title Here</title>
</head>
<body>
<% include("/path/to/include") %>
<h1>Test Template</h1>
<p>Variable: <% print(second_var) %></p>
<%
variable = value;
foreach(params here)
{
code here
}
%>
<p><a href="/" title="Home">Home</a></p>
</body>
</html>
I have tried \<\%(.*)\%\> but that will capture everything including <h1>Test Template</h1> block as well.
Which regex engine are you using?
should work with the “dot matches newline” option enabled. If you don’t know how to set that, try
or
No need to escape
<,%, or>by the way.