Re: Vars inside an sql query [Regular expression question] - Again
| From: | Marek Kilimajer | Date: | Thu, 12 Jun 2003 15:57:34 +0000 |
| Subject: | Re: Vars inside an sql query [Regular expression question] - Again | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-151269@lists.php.net to get a copy of this message | ||
Now I noticed you did not escape backslash that was supposed to escape the dolar sign.
preg_match_all("/^.*('\\\$(.*)')/si", $fcontents,$matches);
^ ^Hatem Ben wrote:
Well, it's finally working, but still very confusing ... thanks all <?php $fcontents = join('' , file('query.txt')); preg_match_all('/(\'\$(.*)\')/si', $fcontents,$matches); print_r($matches) ?> Regards, Hatem ----- Original Message ----- From: "Hatem Ben" <reflex_news@yahoo.fr> To: <php-general@lists.php.net> Cc: "Marek Kilimajer" <kilimajer@webglobe.sk> Sent: Thursday, June 12, 2003 4:35 PM Subject: Re: [PHP] Vars inside an sql query [Regular expression question] - AgainIt's not working also ----- Original Message ----- From: "Marek Kilimajer" <kilimajer@webglobe.sk> To: "Hatem Ben" <reflex_news@yahoo.fr> Cc: <php-general@lists.php.net> Sent: Thursday, June 12, 2003 5:23 PM Subject: Re: [PHP] Vars inside an sql query [Regular expressionquestion] -Againpreg_match_all("/^('\$(.*)')/si", $fcontents,$matches);quote.^^you don't allow any character between start of the string and singlepreg_match_all("/^.*('\$(.*)')/si", $fcontents,$matches); Hatem Ben wrote:clear.I'm asking again the same question, coz i guess my question wasn'tseems to be correct for me, but i don't find why it doesn't wrki just need to retreive vars inside query.txt, my regular expression-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php------ Starting query.txt select * FROMtablewhere 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