Re: Vars inside an sql query [Regular expression question] - Again
| From: | Marek Kilimajer | Date: | Thu, 12 Jun 2003 15:23:06 +0000 |
| Subject: | Re: Vars inside an sql query [Regular expression question] - Again | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-151259@lists.php.net to get a copy of this message | ||
preg_match_all("/^('\$(.*)')/si", $fcontents,$matches);
^^you don't allow any character between start of the string and single quote. preg_match_all("/^.*('\$(.*)')/si", $fcontents,$matches); Hatem Ben wrote:
I'm asking again the same question, coz i guess my question wasn't clear.
i just need to retreive vars inside query.txt, my regular expression seems to be correct for me, but i don't find why it doesn't wrk
------ Starting query.txt
select * FROM table where id='$value' order by name
------ Ending query.txt
------ Starting parse.php
<?php
$fcontents = join('' , file('query.txt'));
preg_match_all("/^('\$(.*)')/si", $fcontents,$matches);
print_r($matches)
?>
--------- Ending parse.php
rewriting query is another question, that i agree also.
Thanks
Hatem