I have a string:
$test = "Test string<i> hello world</i>."
Then I am running
$test = preg_replace('/(<i>{1}\s*)([\w*\d*\D*\W*\x*\O*\S*\s*]*?)(<\/i>{1})/', '<italic>$2</italic>', $test);
And the result is
Test string<italic>hello world</italic>.
Why is the whitespace before the hello world lost?
Here is an example http://pastebin.com/SXFhsCGK.
Thank you.
[\w*\d*\D*\W*\x*\O*\S*\s*]Ouch. What are you trying to do here?(<i>{1}\s*). BTW I guess<i>{1}isn't what You intend, it says "match the<, then match theiand then match (exactly one, which is default)>".preg_replace('%<(/?)i>%', '<$1italic>', $test)