I’m having a bit of a problem here! Basically, what I want to do, is take the string data from out of a pair of XML tags like so:
<Details>This is the string data I want to manipulate</Details>
I want to do a preg_replace to find the contents of the tags, and then wordwrap it, using wordwrap() to 50 chars, with the br / tag. However, the text will NOT wrap, and my breaks, no matter which I use, will NOT be inserted.
Here is my current code:
[code] /* Attempt to wrap text in the
$in_str = "/<Details>(.*?)</Details>/si"; // Looks for whatever is between the tags $replace = "<Details>" . wordwrap("$1", 50, "<br />", FALSE) . "</Details>"; $data = preg_replace($in_str, $replace, $data); [/code]
I’ve played around with a few different ways to phrase this same basic idea, and none have worked… I guess I’m looking for an obvious over-sight or even a totally different, alternate way. Just so long as I can wrap long lines inside of a set of tags, I’ll be happy!
Thanks in advance!