This is the very first time I am trying to use regular expressions, so please have patience.
I would like to use php preg_replace function to transform a string such as this:
"r1=r2+robby+ara"
into
"ar1b=ar2b+robby+ara"
- so for every occurrence of "r" followed by an integer, I want to place an "a" before it and "b" after it.
I have figured out the search part, but not the replace part - the question-mark below indicates where I am having troubles. Is there a way to "remember" the integer found by [0-9] and use it in replace string?
$s="r1=r2+robby + ara";
$s1=preg_replace ( "/r[0-9]/","ar?b",$s);
Thank you