Regular expression match and replace some characters $ aaa = & quot; aaa; bbb; ccc; ddd; eee; fff; & quot; with: & quot; aaa * bbb; ccc * ddd; eee * fff; & quot; do not use php! I just want to replace the regular expression. I don't know who can help solve this problem. The real regular expression matches and replaces some characters.
$ Aaa = "aaa; bbb; ccc; ddd; eee; fff ;"
Replace it with: "aaa * bbb; ccc * ddd; eee * fff ;"
Do not use the php method!
I just want to replace the regular expression. I don't know anyone who can help solve this problem. I really can't think of it!
The purpose is to replace odd digits with * even digits!
Thank you ~
------ Solution --------------------
Echo preg_replace ('/(\ w +); (\ w +)/', '$1 * $ 2', $ aaa );
------ Solution --------------------
It should be replaced once every other time, right?
PHP code
$ Aaa = "aaa; bbb; ccc; ddd; eee; fff;"; echo preg_replace ('# \ G [^;] + \ K; ([^;] + ;?) # ',' * \ 1', $ aaa );