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
replaceText across line breaks
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 29
- Joined: Mon Apr 09, 2012 8:53 pm
Re: replaceText across line breaks
Hi Sieg,

HTH,
THierry
Yes. Prefix your regex with (?ms); then the dot will match a cr..Can this regex be modified so that it will work even with CRs in the text?
Unfortunately, not that simpleI've tried a couple things in online regex testers that work but they fail in LiveCode.

HTH,
THierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
-
- VIP Livecode Opensource Backer
- Posts: 29
- Joined: Mon Apr 09, 2012 8:53 pm
Re: replaceText across line breaks
Thanks, Thierry! That worked. 
