Re: ereg / regexp fun

From: Date: Wed, 16 Aug 2000 15:57:40 +0000
Subject: Re: ereg / regexp fun
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-12038@lists.php.net to get a copy of this message
Try ereg("( :[a-z] )+", $msg) jason > I need to trigger some functions when a user enters a command like ':a' > or ':b' > The command is embedded within $msg; e.g. $msg = 'see :a for info' > Where > the :a will be replaced e.g. by an image... > > see this: > --------- > if(ereg("[^ ]+:([a-z]{1})[ $]+",$msg,$item)){ > ... > } > --------- > > This already works almost. but it matches also unwanted cases, e.g. if > $msg = 'aaaaa:bbbbcccc' > > What is the correct regexp that matches a blank or the beginning of a > string? > What is the correct regexp that matches a blank or the end of a string? > > Thanks, > > - dk

« previous php.general (#12038) next »