Re: regular expressions

From: Date: Fri, 19 May 2000 17:31:10 +0000
Subject: Re: regular expressions
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-209@lists.php.net to get a copy of this message
Thanks, This worked. Still, strange that there is no way to stop the greedy factor (after all, it is one of the seven deadly sins :) Zak Greant wrote: > If you want to be able to use non-greedy expressions, you can use the > perl-style regular expression functions. > > Also, try using a regular expression that is a little more restrictive: > eregi ('<!--CODE:([^:->]+)-->', $line, $regs); > > HTH, > > Zak > > At 12:54 PM 5/19/00 -0400, Victor wrote: > >t doesn't work because I have many of these comments thus > > > ><!--CODE:0001--> > ><!--CODE:AB01--> > > > >this regexp graps "CODE:0001--><!--CODE:AB01" > >I have no idea why this is happening. But php did have similar problems on > >Sparc Solaris before. I still don't get why things like .+? aren't supported, > >even though they are in posix regexp (I think). This .+ seems to be greedy and > >graps as many things as it can. That's not the behavior I want. > > > >Jason Stechschulte wrote: > > > > > There is a man page included with the php distribution. It is regex.7 > > > > > > I'm not sure what your problem is though. Why is what you put not working? > > > > > > -----Original Message----- > > > From: Victor [mailto:victord@wwcd.com] > > > Sent: Friday, May 19, 2000 11:28 AM > > > To: php-general@lists.php.net > > > Subject: [PHP-GENERAL] regular expressions > > > > > > I need to grab a comment > > > > > > <!--CODE:0001--> > > > > > > How can I do non-greed char match .* ?? > > > I did this eregi("<!--CODE\:(.+)-->",$text,$regs); > > > > > > How can I do .+? or something of that nature ??? > > > > > > P.S. > > > Is there a help doc on PHP specific regexp. The O'Reilly book on regular > > > expressions doesn't seem to apply! > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > > For additional commands, e-mail: php-general-help@lists.php.net > > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > >For additional commands, e-mail: php-general-help@lists.php.net > >To contact the list administrators, e-mail: php-list-admin@lists.php.net > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#209) next »