Re: regexp for two quotes

2007-12-24 Thread Jay Savage
On Dec 22, 2007 3:38 AM, Dermot <[EMAIL PROTECTED]> wrote: > > > > On 22/12/2007, Jay Savage <[EMAIL PROTECTED]> wrote: > > > > On Dec 20, 2007 3:54 AM, Dr.Ruud <[EMAIL PROTECTED]> wrote: > > > Rob Dixon schreef: > > > > Dr.Ruud wrote: > > > >> Jay Savage schreef: > > > >>> Corin Lawson wrote: > >

Re: regexp for two quotes

2007-12-21 Thread Jay Savage
On Dec 20, 2007 3:54 AM, Dr.Ruud <[EMAIL PROTECTED]> wrote: > Rob Dixon schreef: > > Dr.Ruud wrote: > >> Jay Savage schreef: > >>> Corin Lawson wrote: > > Can you not simply count the number of quotes mod 2? > >>> > >>> No, you can't just count the number of quotes. An even number of > >>> quo

Re: regexp for two quotes

2007-12-20 Thread Dr.Ruud
Rob Dixon schreef: > Dr.Ruud wrote: >> Jay Savage schreef: >>> Corin Lawson wrote: Can you not simply count the number of quotes mod 2? >>> >>> No, you can't just count the number of quotes. An even number of >>> quotes doesn't mean they're all double quotes. Consider something >>> like q|a'b

Re: regexp for two quotes

2007-12-19 Thread Rob Dixon
Dr.Ruud wrote: "Jay Savage" schreef: Corin Lawson wrote: Can you not simply count the number of quotes mod 2? No, you can't just count the number of quotes. An even number of quotes doesn't mean they're all double quotes. Consider something like q|a'b'c''d'e'f|. I haven't read anywhere yet

Re: regexp for two quotes

2007-12-19 Thread Dr.Ruud
"Jay Savage" schreef: > Corin Lawson wrote: >> Can you not simply count the number of quotes mod 2? > > No, you can't just count the number of quotes. An even number of > quotes doesn't mean they're all double quotes. Consider something like > q|a'b'c''d'e'f|. I haven't read anywhere yet that the

Re: regexp for two quotes

2007-12-19 Thread Dr.Ruud
Rob Dixon schreef: > Dr.Ruud wrote: >> Rob Dixon schreef: >>> scooter: Can someone help me with the regexp that will match exactly two quotes(') or no quotes in the string. If a single quote exists, then will break out. eg: aabbcc - Should Match aa''bb''c''c - S

Re: regexp for two quotes

2007-12-19 Thread Jay Savage
Please don't top post... On Dec 18, 2007 6:41 PM, Corin Lawson <[EMAIL PROTECTED]> wrote: > Hi ab, > > Can you not simply count the number of quotes mod 2? > No, you can't just count the number of quotes. An even number of quotes doesn't mean they're all double quotes. Consider something like q|a

Re: regexp for two quotes

2007-12-18 Thread Rob Dixon
Dr.Ruud wrote: Rob Dixon schreef: scooter: Can someone help me with the regexp that will match exactly two quotes(') or no quotes in the string. If a single quote exists, then will break out. eg: aabbcc - Should Match aa''bb''c''c - Should Match a''b - Should Match ab'' - Should Match aa'

Re: regexp for two quotes

2007-12-18 Thread Corin Lawson
Hi ab, Can you not simply count the number of quotes mod 2? Cheers, Corin. On 19/12/2007, at 6:23 AM, scooter wrote: Can someone help me with the regexp that will match exactly two quotes(') or no quotes in the string. If a single quote exists, then will break out. eg: aabbcc - Should Match

Re: regexp for two quotes

2007-12-18 Thread Dr.Ruud
Rob Dixon schreef: > scooter: >> Can someone help me with the regexp that will match exactly two >> quotes(') or no quotes in the string. >> If a single quote exists, then will break out. >> >> eg: >> aabbcc - Should Match >> aa''bb''c''c - Should Match >> a''b - Should Match >> ab'' - Should Ma

Re: regexp for two quotes

2007-12-18 Thread Rob Dixon
Dr.Ruud wrote: scooter schreef: Can someone help me with the regexp that will match exactly two quotes(') or no quotes in the string. If a single quote exists, then will break out. eg: aabbcc - Should Match aa''bb''c''c - Should Match a''b - Should Match ab'' - Should Match aa'bbcc - Should

Re: regexp for two quotes

2007-12-18 Thread Rob Dixon
scooter wrote: Can someone help me with the regexp that will match exactly two quotes(') or no quotes in the string. If a single quote exists, then will break out. eg: aabbcc - Should Match aa''bb''c''c - Should Match a''b - Should Match ab'' - Should Match aa'bbcc - Should not Match aa''bb'c

Re: regexp for two quotes

2007-12-18 Thread Tom Phoenix
On 12/18/07, yitzle <[EMAIL PROTECTED]> wrote: > I tried to do something like the following, but it didn't work. It > fails on a zero-quote line. No idea why. > /^([^']*'[^']*'[^']*)*$/ No idea? Here's one: If it is to match a non-trivial string, your pattern needs to find at least two apostrophe

Re: regexp for two quotes

2007-12-18 Thread Dr.Ruud
scooter schreef: > Can someone help me with the regexp that will match exactly two > quotes(') or no quotes in the string. > If a single quote exists, then will break out. > > eg: > aabbcc - Should Match > aa''bb''c''c - Should Match > a''b - Should Match > ab'' - Should Match > > > aa'bbcc - Sho

Re: regexp for two quotes

2007-12-18 Thread Tom Phoenix
On 12/18/07, scooter <[EMAIL PROTECTED]> wrote: > Can someone help me with the regexp that will match exactly two > quotes(') or no quotes in the string. > If a single quote exists, then will break out. You are saying what you want for the cases of zero, one, or two single quote marks in the stri

Re: regexp for two quotes

2007-12-18 Thread yitzle
Nasty piece of code, but works: __CODE__ while (<>) { print; my @a = /\'/g ; print "MATCH\n" if not scalar (@a) % 2; } __END__ Matches blank lines as well. I tried to do something like the following, but it didn't work. It fails on a zero-quote line. No idea why. /^([^']*'[^']*'[^']*)

regexp for two quotes

2007-12-18 Thread scooter
Can someone help me with the regexp that will match exactly two quotes(') or no quotes in the string. If a single quote exists, then will break out. eg: aabbcc - Should Match aa''bb''c''c - Should Match a''b - Should Match ab'' - Should Match aa'bbcc - Should not Match aa''bb'cc - Should not Ma