Switching the code of the debate forum on my website, I am going to change the way quotes are stored in the database. Now I need to come up with a regex to rearrange already submitted posts in my database.
Following is an example of how my current debate post are stored in the database (with quotes in quotes).. Note: I have indented it for the sake of illustration:
Just citing a post
[quote]Text of quote #3
[quote]Text of quote #2
[quote]Text of quote #1
[name]User 1[/name]
[/quote]
[name]User 2[/name]
[/quote]
[name]User 3[/name]
[/quote]
What I would like now, is that the former will be rearranged to look like this:
Just citing a post
[quote:User 3]
Text of quote #3
[quote:User 2]
Text of quote #2
[quote:User 1]
Text of quote #1
[/quote]
[/quote]
[/quote]
Can any of you point me in the direction of how this can be done with regex? I am using PHP.
Thanks in advance, I appreciate all your help :)
Fischer