pcre pattern match help

From: Date: Tue, 17 Dec 2002 18:28:55 +0000
Subject: pcre pattern match help
Groups: php.general 
Request: Send a blank email to php-general+get-128595@lists.php.net to get a copy of this message
Hi- I would like to do a pattern match against a string, sometimes this pattern will include the full string, and sometimes it will not, if the pattern does not include the second match I still want to get the first pattern match. Below is my code, and the results I am looking for. Thanks in advance, Max preg_match ("/\:\[(\S+)\]\:(\S*)/",$transport,$matches); print_r ($matches); $tranport = ":[127.0.0.l)"; print_r ($transport) -> Array ( ) ** I want this to return "127.0.0.1" $transport = "smtp:[64.70.36.4]:25"; print_r ($transport) -> Array ( [0] => :[64.70.36.4]:25 [1] => 64.70.36.4 [2] => 25 )

« previous php.general (#128595) next »