|
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]
Navigation:
[Reply to this message]
|