Re: grouping in regex

2012-12-25 Thread Paul Johnson
On Mon, Dec 24, 2012 at 08:01:11PM +, Rob Dixon wrote: > On 24/12/2012 13:08, Paul Johnson wrote: > >On Sun, Dec 23, 2012 at 06:57:38PM +0530, punit jain wrote: > >>I am seeing which lines have both POP and Webmail as below :- > >> > >>if( $line =~ /AccessModes\s*=\s*.*(WebMail)*.*(POP).*(WebMa

Re: grouping in regex

2012-12-24 Thread Rob Dixon
On 24/12/2012 13:08, Paul Johnson wrote: On Sun, Dec 23, 2012 at 06:57:38PM +0530, punit jain wrote: Hi, I am doing grouping but seeing some weird behavior :- the strings in a file are like :- AccessModes = (18,Mail,POP,IMAP,PWD,WebMail,WebSite,Relay,Mobile,FTP,MAPI,TLS,LDAP,WebCAL); ...

Re: grouping in regex

2012-12-24 Thread Paul Johnson
On Sun, Dec 23, 2012 at 06:57:38PM +0530, punit jain wrote: > Hi, > > I am doing grouping but seeing some weird behavior :- > > the strings in a file are like :- > AccessModes = > (18,Mail,POP,IMAP,PWD,WebMail,WebSite,Relay,Mobile,FTP,MAPI,TLS,LDAP,WebCAL); > > ... > . > multiple lines > >

Re: grouping in regex

2012-12-24 Thread Rob Dixon
On 23/12/2012 13:27, punit jain wrote: Hi, I am doing grouping but seeing some weird behavior :- the strings in a file are like :- AccessModes = (18,Mail,POP,IMAP,PWD,WebMail,WebSite,Relay,Mobile,FTP,MAPI,TLS,LDAP,WebCAL); ... . multiple lines I am seeing which lines have both POP and Web

Re: grouping in regex

2012-12-23 Thread shawn wilson
it might be better to use a named capture here since you're expecting certain things and then you don't have to do if defined. On Sun, Dec 23, 2012 at 5:43 PM, Zachary Bornheimer wrote: > For this error, try something like this: > > Take note of any regex changes that you were advised in other em

Re: grouping in regex

2012-12-23 Thread Zachary Bornheimer
For this error, try something like this: Take note of any regex changes that you were advised in other emails if ( $line =~ /AccessModes\s*=\s*.*(WebMail)*.*(POP).*(WebMail)*.*/ ) { if (defined $2 && $2 && $1 ) { print $2 . " " . $1 . $line . "\n"; } } Make sure that $2 is initia

Re: grouping in regex

2012-12-23 Thread John W. Krahn
Danny Gratzer wrote: Shouldn't that *.** be *.*? *to avoid having it consume everything? It is not clear exactly which *.** you are referring to however a non-greedy match does not necessarily consume less than a greedy match. John -- Any intelligent fool can make things bigger and more c

Re: grouping in regex

2012-12-23 Thread Danny Gratzer
Shouldn't that *.** be *.*? *to avoid having it consume everything? On Sun, Dec 23, 2012 at 10:01 AM, Ken Slater wrote: > On Sun, Dec 23, 2012 at 8:27 AM, punit jain > wrote: > > Hi, > > > > I am doing grouping but seeing some weird behavior :- > > > > the strings in a file are like :- > > Acc

Re: grouping in regex

2012-12-23 Thread Ken Slater
On Sun, Dec 23, 2012 at 8:27 AM, punit jain wrote: > Hi, > > I am doing grouping but seeing some weird behavior :- > > the strings in a file are like :- > AccessModes = > (18,Mail,POP,IMAP,PWD,WebMail,WebSite,Relay,Mobile,FTP,MAPI,TLS,LDAP,WebCAL); > > ... > . > multiple lines > > I am seeing

grouping in regex

2012-12-23 Thread punit jain
Hi, I am doing grouping but seeing some weird behavior :- the strings in a file are like :- AccessModes = (18,Mail,POP,IMAP,PWD,WebMail,WebSite,Relay,Mobile,FTP,MAPI,TLS,LDAP,WebCAL); ... . multiple lines I am seeing which lines have both POP and Webmail as below :- if( $line =~ /AccessMod