substrings

From: Date: Sun, 25 Apr 2004 20:00:30 +0000
Subject: substrings
Groups: php.general 
Request: Send a blank email to php-general+get-184581@lists.php.net to get a copy of this message
Hi, all -- I must be having a brain fart as well as going blind because I can't find in the manual how to do this. Given a string like #AABBCC or #112233 how do I get the 2nd-3rd 4th-5th 6th-7th position substrings so I can break out the red, green, and blue values? All of the regular expressions seem to hinge on matching a separator, and the closest thing seems to be a preg_match(".(..)(..)(..)",$color,$colors) ; $r = $colors[1] ; $g = $colors[2] ; $b = $colors[3] ; but it just seems like I should be able to return a list like ($r,$g,$b) = fn(operands,$color) ; or so. TIA & HAND :-D -- David T-G davidtg@justpickone.org http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

« previous php.general (#184581) next »