|
Posted by gosha bine on 04/18/07 13:20
On 18.04.2007 15:07 Ben wrote:
> Hi,
>
> To simplify this request, we supposed this following sql script:
>
> "insert into table a values ('me;you','then'); insert into table a
> values ('you;me','so');"
>
> Note the semi-colon ( ; ) in strings for the first field in both
> queries.
>
> How to split that with preg_split() ?
>
> Thanks
>
> Ben
>
hi
I think the regexp code should be something like
$sql =
"insert into table a values ('me;you','then'); insert into table a
values ('you;me','so');"
;
preg_match_all(
"/('(\\\\.|.)*?'|[^;])+/s",
$sql,
$matches);
$stmts = $matches[0];
print_r($stmts);
--
gosha bine
extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
[Back to original message]
|