Either solution will handle that.
The simple solution will often not work if it is part of a larger regex. For example,
/<%(.*?)%> home <%(.*?)%>/ =~
"Go <% now %> to <% your %> home <% if %> you <% can %>"
# ^^(^^^^^^^^^^^^^^^^^)^^^^^^^^^^(^^)^^
will match as shown on that third line. Note that the first part matches too much. This is because a non-greedy part prefers to match sooner at the expense of being "more greedy" than to fail to match or to match later.
- tye |