Grep Challenge/Multi-line HTML chunks

Ken Ray kray at sonsothunder.com
Fri Apr 12 01:41:01 EDT 2002


One thing I forgot... you need to use MC 2.4.2 in order to use this code.
The "perl-compatible regular expressions" support in MC 2.4.2 is crucial to
have this work.

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/

----- Original Message -----
From: "Sivakatirswami" <katir at hindu.org>
To: <use-revolution at lists.runrev.com>
Sent: Friday, April 12, 2002 12:02 AM
Subject: Re: Grep Challenge/Multi-line HTML chunks


> Ken, thank you! too simple... (smile) and you are right, line breaks nee
> don't need to be respected... in fact don't want to be, as they are part
of
> the "problem"  in terms of different editors breaking the code
> for clarity using their own idea... some adding two blank lines
> between sections etc... others not.
>
>
> on 4/10/02 7:02 PM, Ken Ray wrote:
>
> > on ReplaceFooter sourceString,replaceString
> > local tStart,tEnd
> > get matchChunk(tText,"(?s)<!--Footer Text-->(.*)</HTML>",tStart,tEnd)
> > if it is true then
> >   put replaceString into char tStart to tEnd of sourceString
> >   return sourceString
> > else
> >    answer "Matching error."
> > end if
> > end ReplaceFooter
> >
> > Keep in mind that this does not follow your rule "</HTML>" is on its own
> > line - it doesn't have to be. The regex (?s) tells MC to treat
> > 'sourceString' as if everything was on one line, so line breaks are
ignored.
> > If you want line breaks to be respected,  let me know and I'll give you
> > alternative code. But if this is for HTML, it shouldn't matter if
</HTML> is
> > on its own line or not.
>
>
> Hinduism Today
>
> Sivakatirswami
> Editor's Assistant/Production Manager
> katir at hindu.org
> www.HinduismToday.com, www.HimalayanAcademy.com,
> www.Gurudeva.org, www.hindu.org
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>





More information about the use-livecode mailing list