How can I separate a list of SQL queries from a file?

If all queries end with \[code\];\[/code\] I can explode by this char, but what should I do when a \[code\];\[/code\] appears in a field?e.g.\[code\][...]Select * From my_data where idk=';';\nSelect [...] \[/code\]or\[code\][...]Select * From my_data where idk=';\n';Select [...]\[/code\]My file consists of all kinds of queries, including \[code\]INSERT\[/code\]s and can have syntax variations like the ones shown above where a \[code\];\[/code\] is followed by a new line sometimes inside a field.How can deal with this problem?PHP functions like \[code\]explode\[/code\] will fail, would \[code\]eregi\[/code\] or \[code\]preg_match\[/code\] work?
 
Back
Top