Re: Problem with repeating characters in regex

2007-09-27 Thread Rob Dixon
Mike Martin wrote: On 27/09/2007, Rob Dixon <[EMAIL PROTECTED]> wrote: Mike Martin wrote: Hi I am trying to capture only the first occurence of a charcter followed by any word ie: in this sample text !this is a first level heading !!this is a 2nd level heading I only want to find the first

Re: Problem with repeating characters in regex

2007-09-27 Thread John W. Krahn
Rob Dixon wrote: Mike Martin wrote: $line=~s/\!(^\![A-Z][a-z].+)/$1/gc; $line =~ s/^!(![a-z].+)/$1/gi; You are both using an anchored pattern with the /g option which makes no sense unless you are also using the /m option. John -- Perl isn't a toolbox, but a small machine shop where y

Re: Problem with repeating characters in regex

2007-09-27 Thread Rob Dixon
Mike Martin wrote: Hi I am trying to capture only the first occurence of a charcter followed by any word ie: in this sample text !this is a first level heading !!this is a 2nd level heading I only want to find the first item and not the second current code $line=~s/\!(^\![A-Z][a-z].+)/$1/gc;

Re: Problem with repeating characters in regex

2007-09-27 Thread Paul Lalli
On Sep 27, 8:58 am, [EMAIL PROTECTED] (Mike Martin) wrote: > Hi I am trying to capture only the first occurence of a charcter > followed by any word ie: in this sample text > > !this is a first level heading > !!this is a 2nd level heading > > I only want to find the first item and not the second >