Reply to Re: [PHP] Optimal Regex?

Your name:

Reply:


Posted by Jochem Maas on 09/27/05 10:43

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?
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация