Reply to Re: PHP and Regex

Your name:

Reply:


Posted by Sandman on 08/22/06 18:13

In article <WNGGg.17010$o27.12331@newssvr21.news.prodigy.com>,
"mark babli" <mbabli@photozig.com> wrote:

> Hello,
>
> if I extracted a string from a file ( ="test"; )
> How can I extract the word test from here. Sorry if this is not related to
> php (rather regular expression) but, I'll appreciate any help.

That's too general of a question. Do you want to extract alpha
character found within the quotes, or can it look differently? To
answer your question:


#!/usr/bin/php
<?
$string = '( ="test"; )';
preg_match("/\( =\"(\w+)\"; \)/", $string, $m);
print $m[1];
?>

Output: test

--
Sandman[.net]

[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

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