Re: Optimal Regex?

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

 



Jasper Bryant-Greene wrote:
David Pollack wrote:

Ok, so this is the actual code that I'm using.

<?

$string = "( 334, -53.44) ( 111 , 222 )";
$testStr = $string;
// $string = str_replace(" ", "", $string);
preg_match_all("-?([\d]+)?(\.[\d]+)?",$string, $matches);


preg_match_all("/-?([\d]+)?(\.[\d]+)?/", $string, $matches);

		  ^--------------------^---------delimiters

you can use almost any char you like (beware of chars that have
special), use the same at the
start and end, you can't use your chosen delimiter in the
expression without escaping it (backslashing).

pop quiz:

preg_match_all("#rufus#i", $string, $matches);
		       ^
			\--- what is this?	


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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