Optimal Regex?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I need to catch all instances of a coordinate in a give string. So far I
have this, which only works if the coordinate is in a certain format.


$string = (334,-53.44),(111,222);
$expression = '([(][-]?[0-9]*[.0-9]*?,[-]?[0-9]*[.0-9]*?[)])';
preg_match_all($expression, "$string", $matches);

This returns the correct strings (334,-53.44) and (111,222), but I'd like
all formats to work. Like (111, 222), ( 111 , 222 ), (111, 222 ), etc, etc.
How would I change my regex to accomplish this?

--
David Pollack
DHPollack@xxxxxxxxx

www.atlspecials.com <http://www.atlspecials.com>
www.da3.net <http://www.da3.net>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux