View Full Version : preg_replace - regex question

06-24-2005, 06:46 PM

Have a query string similiar to the below:

$str = 'select * from :table_categories_description left join :table_categories using (id) where ...'

Is there a rexp that will do _five_ matches and replace with a given value, the values to replace on are if the character after the token e.g. ':table_categories' is in the set[ ,)"], e.g either a whitespace, comma, close parenthesis,double-quote, or that the token is at the very end of the given $str string. Basically trying to match and replace either the five types of occurances with one call (without changing things like ':table_categories_description' etc).