Regular expressions and php

sergil

New Member
Say I have a string like this:\[code\]$string = 'The /*quick*/ brown /*fox*/ jumped over the lazy /*dog*/.';\[/code\]How can I use a regular expression to find the occurrences of /* */ and replace each value like so:\[code\]/*quick*/ with the value of $_POST['quick']/*fox*/ with the value of $_POST['fox']/*dog*/ with the value of $_POST['dog']\[/code\]I have tried with preg_replace using this pattern: \[code\]~/\*(.+)\*/~e\[/code\]But it does not seem to be working for me.
 
Back
Top