Prev: NetBeans Question
Next: Another NetBeans Question
From: "Tanel Tammik" on 7 Jun 2010 15:54 "Peter Lind" <peter.e.lind(a)gmail.com> wrote in message news:AANLkTilQkZ8DNC0ZAcFv70tcTF2WQKGpZOJcCqtuWu8C(a)mail.gmail.com... > On 1 June 2010 17:33, Ashley Sheridan <ash(a)ashleysheridan.co.uk> wrote: >> On Tue, 2010-06-01 at 16:31 +0100, Richard Quadling wrote: >> >>> $re1 = '/^[a-z]++$/i'; >>> $re2 = '/^[a-z ]++$/i'; >>> >>> >>> >>> -- >>> ----- >>> Richard Quadling >>> "Standing on the shoulders of some very clever giants!" >>> EE : http://www.experts-exchange.com/M_248814.html >>> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp >>> Zend Certified Engineer : >>> http://zend.com/zce.php?c=ZEND002498&r=213474731 >>> ZOPA : http://uk.zopa.com/member/RQuadling >>> >> >> >> Why the double ++ in the expressions there? Surely one + would match the >> 1 or more characters that you need and the second one would just be >> surplus? >> > > Equally important: why have three people already done this persons > homework. 5 minutes googling would have answered this ... > > > -- > <hype> > WWW: http://plphp.dk / http://plind.dk > LinkedIn: http://www.linkedin.com/in/plind > BeWelcome/Couchsurfing: Fake51 > Twitter: http://twitter.com/kafe15 > </hype> i made an regular expression now by myself. i need to check if string starts with 'get' and is followed only by letters a-z case insensitive. am i correct? '/^get[a-z]++$/i' Br Tanel
From: Ashley Sheridan on 7 Jun 2010 17:52
On Mon, 2010-06-07 at 22:54 +0300, Tanel Tammik wrote: > "Peter Lind" <peter.e.lind(a)gmail.com> wrote in message > news:AANLkTilQkZ8DNC0ZAcFv70tcTF2WQKGpZOJcCqtuWu8C(a)mail.gmail.com... > > On 1 June 2010 17:33, Ashley Sheridan <ash(a)ashleysheridan.co.uk> wrote: > >> On Tue, 2010-06-01 at 16:31 +0100, Richard Quadling wrote: > >> > >>> $re1 = '/^[a-z]++$/i'; > >>> $re2 = '/^[a-z ]++$/i'; > >>> > >>> > >>> > >>> -- > >>> ----- > >>> Richard Quadling > >>> "Standing on the shoulders of some very clever giants!" > >>> EE : http://www.experts-exchange.com/M_248814.html > >>> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp > >>> Zend Certified Engineer : > >>> http://zend.com/zce.php?c=ZEND002498&r=213474731 > >>> ZOPA : http://uk.zopa.com/member/RQuadling > >>> > >> > >> > >> Why the double ++ in the expressions there? Surely one + would match the > >> 1 or more characters that you need and the second one would just be > >> surplus? > >> > > > > Equally important: why have three people already done this persons > > homework. 5 minutes googling would have answered this ... > > > > > > -- > > <hype> > > WWW: http://plphp.dk / http://plind.dk > > LinkedIn: http://www.linkedin.com/in/plind > > BeWelcome/Couchsurfing: Fake51 > > Twitter: http://twitter.com/kafe15 > > </hype> > > i made an regular expression now by myself. i need to check if string starts > with 'get' and is followed only by letters a-z case insensitive. am i > correct? > > '/^get[a-z]++$/i' > > Br > Tanel > > > Yep, that looks right. If you're in any doubt, there are lots of online regex testers which you can run strings and patterns against. Just Google for them. Thanks, Ash http://www.ashleysheridan.co.uk |