Thats it, Thanks !
But the problem that I had was with newlines and returns.
Ex. To keep the query looking clean I had something like this
SELECT name.employes, birhtdate.employes,
building.room, nr.room,
name.dept, manager.dept, id.dept,
...
FROM ...
Instead of writing it in a single line.
This is how I solved the problem
<?php
$query = str_replace("\r" , "" , $query);
$query = str_replace("\n" , "" , $query);
$query = str_replace("\t" , "" , $query);
$regex = "/^SELECT .* FROM/i";
// $regex = "/^SELECT (.|\n|\s|\t|\r)* FROM/i"; <--- this did not work for me
?>
Once again, thanks for the shorter regex.