M
Max Metral
I'm matching some ASP.net code with some perl regex's to do localization.
I'm having some trouble with asp's embedded use of <% %> and differentiating
it from the html tag... So, the thing I'm matching is like:
<tag a=b c="d">stuff</tag>
My reg ex is:
<tag([^>]*?)>(.*?)</tag>
Which works fine for the first example. But it doesn't for this:
<tag a=b c="<%foo%>">stuff</tag>
As expected, it stops after %>. Question is, how can I modify the
expression to still get the whole "attribute section" in that single
match... I've tried various back reference constructs, but they don't seem
to do it. The expression fragment I want is "match everything except right
bracket, unless there was a % before the right bracket"...
Hrmph,
--Max
I'm having some trouble with asp's embedded use of <% %> and differentiating
it from the html tag... So, the thing I'm matching is like:
<tag a=b c="d">stuff</tag>
My reg ex is:
<tag([^>]*?)>(.*?)</tag>
Which works fine for the first example. But it doesn't for this:
<tag a=b c="<%foo%>">stuff</tag>
As expected, it stops after %>. Question is, how can I modify the
expression to still get the whole "attribute section" in that single
match... I've tried various back reference constructs, but they don't seem
to do it. The expression fragment I want is "match everything except right
bracket, unless there was a % before the right bracket"...
Hrmph,
--Max