Say I have a string like this:
$sql = "insert into BENEF (BEN_NOM,BEN_PRENOM,BEN_ADR1,BEN_CREATED_ON,BEN_ENABLED) values ('Houn','Luc','l\"oule (1)','2014-09-17 17:45:08','1');";
How to write a regexp to extract just :
1 => BENEF
2 => BEN_NOM,BEN_PRENOM,BEN_ADR1,BEN_CREATED_ON,BEN_ENABLED
3 => 'Houn','Luc','l\"oule (1)','2014-09-17 17:45:08','1'
I tried :
$motif = '/insert into (.*) \(([^)]*)\) values \(([^)]*)\)/';
preg_match($motif,$sql , $out);
But unfortunaly "(1)" data corrupt results
in other words how to extract TABLE X Y with :
insert into TABLE (X) values (Y);
why this doesn't work ?
$motif = '/^insert into (.*) \(([^)]*)\) values \(([^)]*)\);$/'
Regards
finaly find :
'/^insert into (\S+) \((.*)\) values \((.*)\);$/'