Grep -- How to match segment containing many lines

Jim Ault JimAultWins at yahoo.com
Sat May 12 12:18:41 EDT 2007


you should look at the (?) directive syntax

such as (?i) = case sensitive
(?si) = ignore line endings + case sensitive
(?Usi) = ungreedy + ignore + sensitive

I think you want [greedy + ignore line endings] so use

put "(?s)<div id="linklist">(.*?)</html>" into regEx
get matchChunk(textBlock,regEx,charpos1,charpos2)
delete char charpos1 to charpos2 of textBlock

This should get you close to what you want.

Jim Ault
Las Vegas


On 5/12/07 2:08 AM, "Sivakatirswami" <katir at hindu.org> wrote:

> I want to replace a chunk many files
> 
> <div id="linklist">
> # lots of other stuff here, many lines all inconsistent
> across many files##
> </html>
> 
> <div id="linklist">(.*?)</html>
> 
> <div id="linklist">(.*)</html>
> 
> isn't working... I suspect because of the many lines
> issue and I am having trouble finding the answer to
> how to get grep to ignore line endings?
> 
> I'm sure it's really simple, but even after looking thru
> BBEdit's grep help I can't find it.
> 
> TIA
> 
> Sivakatirswami
> www.himalayanacademy.com
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the use-livecode mailing list