Grep Challenge/Multi-line HTML chunks

Sivakatirswami katir at hindu.org
Fri Apr 12 01:04:02 EDT 2002


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




More information about the use-livecode mailing list