php - Regex not capturing properly -
Here is a query that I want to create an array of parameters:
$ subject = "SELECT * a_table with WHERE something = 'col1 =: param1' and col2 =: param2 or col3 =: param3"; I tried:
$ pattern = "^ ([\" ']) (?: (? = (\\\\?) ) \\ 2.) *? \\ 1 ^ "$ subject = preg_replace ($ pattern," "$ $ subject"); and
$ Pattern = '# [:] [A-zA-Z0-9 _] + # '; preg_match_all ($ pattern, $ theme, $ matches); print_r ($ matches); Unfortunately, I only want to Param2 and param3 found as output I would like to see my dump like this:
Array ([0] = & Gt ;: param1 [1] = & gt;: Ultimate 2 [2] = & gt;: param3)
You can just use this regex = (: \ w +) $ query = "SELECT * to a_table Where some = '$ 1 = $; & I; $ I ++) resonate {$ params [1] [$ i]. "
Comments
Post a Comment