In PHP I have a string with a value of something like 1 OR 2 or maybe 1 AND (20 OR 3). I would like to replace those numbers with a phrase followed by the number to make something like condition1 meaning:
1 OR 2 => condition1 OR condition2
1 AND (20 OR 3) => condition1 AND (condition20 OR condition3)
I think I can use preg_replace to do this but I can't figure out how. I'm having a difficult time preserving the value of the numbers during the replacement.
If it makes it easier I will also accept an answer in javascript