Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    112
    Thanks
    0
    Thanked 0 Times in 0 Posts

    regex for bbcode

    hi

    I have the following regex that I wish to modify.

    Code:
     '/(?<!\\\\)\[quote(?::\w+)?\](.*?)\[\/quote(?::\w+)?\]/si'         => "<div class=\"quote\">\\1</div>",
    			  '/(?<!\\\\)\[quote(?::\w+)?=(?:&quot;|"|\')?(.*?)["\']?(?:&quot;|"|\')?\](.*?)\[\/quote\]/si'   => "<div>Quote \\1:<div class=\"quote\">\\2</div></div>",
    this will give me something like:
    Code:
    <div class="quote">something quoted here</div>
    I have problems when someone enter (quote)(quote) something (/quote)(/quote). I'm trying to modify the regex so that it'll be convert all (/quote) to </div> and (quote) to <div class="quote">

    I also want to convert (quote from username) something (/quote) to <div class="quotehead>username</div><div class="quote">something </div>

    Note: I replaced the square brackets to round brackets incase it got converted by this board.

    Thank you.

  • #2
    Regular Coder
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    112
    Thanks
    0
    Thanked 0 Times in 0 Posts
    never mind. I searched the forums and found a solution which I modified to work. Sorry for the trouble.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •