Help with Regex in PHP

AlexComarinoso

New Member
Let's assume I do preg_replace as follows: \[code\]preg_replace ("/<my_tag>(.*)<\/my_tag>/U", "<my_new_tag>$1</my_new_tag>", $sourse);\[/code\]That works but I do also want to grab the attribute of the my_tag - how would I do it with this:\[code\]<my_tag my_attribute_that_know_the_name_of="some_value">tra-la-la</my_tag>\[/code\]
 
Back
Top