Hi All,

 

I'm hoping someone can help me figure out a regex that will replace
pseudo-HTML codes in a string with desired HTML equivalents. In particular,
I'm trying to implement a message quoting facility, such as when you click
on the 'quote'  button in phpBB.

 

An example of a source string would be:

 

<source string>

 

[quote="John"]Some quoted text.

 

Some more quoted text.

 

[quote="Mary"]My older comment.[/quote][/quote]

 

My current comments.

 

</source string>

 

Ideally, I'd like this to become something like:

 

<regexed string>

 

<div class='quotehead'>

            John wrote:

</div>

<div cass='quote'>

            Some quoted text.

 

Some more quoted text.

<div class='quotehead'>

            Mary wrote:

</div>

<div class='quote'>

            My older comment.

</div>

</div>

 

My current comments.

 

</regexed string>

 

Given that pseudo-HTML seems common on bulletin board systems I'd hoped
there'd be a published function available to handle it, but I haven't had
any luck finding one and while I've been able to find a couple of regex
examples (eg http://www.regexlib.com/REDetails.aspx?regexp_id=520) they
appear to be aimed at ASP.NET rather than PHP and my attempts to get them
working in PHP (hampered, admittedly, by my general confusion about regex's)
haven't met with any luck.

 

Truly, any help immensely appreciated!

 

Much warmth,

 

Murray

 

Reply via email to