Red Squirrel
No Lifer
I'm working on converting a forum and having issues with nested quotes. In phpbb quote format is the following:
(replacing square brackets with "(" )
aaaaaaaaaa is a random alpha numerical string. I managed to figure out how to convert a single quote with this code:
But if there is a nested quote, then it somehow actually deletes the first occurance of the first quote start. So I end up with the deepest nested quote but all the others only have a [/quote] at the end as the starts get deleted.
Is there a better way I can do this? Regular expressions arn't really my strength so there's probably a better way of doing it.
(replacing square brackets with "(" )
Code:
(quote:aaaaaaaaaa="author") text (quote:aaaaaaaaaa)
aaaaaaaaaa is a random alpha numerical string. I managed to figure out how to convert a single quote with this code:
Code:
$ret = preg_replace('~\[quote:(.*)="(.*)"\]~', '[quote author="${2}"]', $ret);
$ret = preg_replace('~\[/quote:(.*)\]~', '[/quote]', $ret);
But if there is a nested quote, then it somehow actually deletes the first occurance of the first quote start. So I end up with the deepest nested quote but all the others only have a [/quote] at the end as the starts get deleted.
Is there a better way I can do this? Regular expressions arn't really my strength so there's probably a better way of doing it.