replaceText across line breaks
Posted: Sat Jan 04, 2014 9:27 pm
Regular expressions are new to me and perplexing. In the following snippet I am trying to completely remove everything from and including the "<" in the <ul> tag through the ">" in the </ul> tag.
<div class="title">
<ul class="iconkey" style="color: #000; font-weight: bold;">
<li>ICON KEY:</li>
<li class="location-2">City</li>
</ul>
</h2>
</div><!-- /Title -->
To that end, the following works fine if there are no line breaks between "<ul" and "</ul>." But it doesn't work when there are CRs in the text.
function removeIconKey tagVar
put "<ul class=" & quote & "iconkey" & quote & ".*</ul>" into iconUL
return replaceText(tagVar,iconUL, empty)
end removeIconKey
Can this regex be modified so that it will work even with CRs in the text? If so, how? I've tried a couple things in online regex testers that work but they fail in LiveCode.
Best,
Sieg
<div class="title">
<ul class="iconkey" style="color: #000; font-weight: bold;">
<li>ICON KEY:</li>
<li class="location-2">City</li>
</ul>
</h2>
</div><!-- /Title -->
To that end, the following works fine if there are no line breaks between "<ul" and "</ul>." But it doesn't work when there are CRs in the text.
function removeIconKey tagVar
put "<ul class=" & quote & "iconkey" & quote & ".*</ul>" into iconUL
return replaceText(tagVar,iconUL, empty)
end removeIconKey
Can this regex be modified so that it will work even with CRs in the text? If so, how? I've tried a couple things in online regex testers that work but they fail in LiveCode.
Best,
Sieg