ereg / regexp fun

From: Date: Wed, 16 Aug 2000 15:27:22 +0000
Subject: ereg / regexp fun
Groups: php.general 
Request: Send a blank email to php-general+get-12031@lists.php.net to get a copy of this message
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 (#12031) next »