I am trying to select every query with SELECT in the start and LIMIT in the end, for example:
$SelQuery = "SELECT DISTICNT C.firstname,C.lastname,C.id as clientid,QC.category_name,QR.cid,QR.catid,QR.rhid
FROM cms_question_report QR, cms_clients C,cms_questioncategory QC ,cms_reporthistory RH
WHERE C.id=QR.cid
AND QR.rhid=RH.id
AND QR.catid='".$objArray['catid']."'
AND QR.catid=QC.id
AND C.id IN($SelClids)
LIMIT $page_no,$this->Limit";
And not select any other query that doesn't contain LIMIT. So the regex I thought would work was this:
SELECT .*\n* LIMIT
Where I'm basically stating that it has to start with "SELECT" then any other characters and ends with LIMIT, the only issue is I don't know how to handle the \n*, I have multiple unknown number of new lines and in each line there are unknown characters, so I'm assuming it should go like this \n*.\n.* and so on, but there definitely is a way where I can say select any character including a new line.
I have tried using this solution: Regex to match any character including new lines and adjusted my regex to:
SELECT /s* LIMIT
but that didn't work as well.
Also tried:
SELECT (.|\n)* LIMIT
but it didn't work.