Results 1 to 3 of 3

Thread: Regular Expressions and BBCode Parsing

  1. #1

    Thread Starter
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Question Regular Expressions and BBCode Parsing

    I'm working on a small feature for one of my websites that involves basic BBCode parsing and I'm having difficulty getting it to work 100%.

    Basically I'm trying to use Regular Expressions for the matching but certian ones don't seem to always match correctly.

    For example, I use the following Regular Expression Pattern for figuring out where the [code][/code] tags are and replace them:
    Code:
    "\[code\](.+?)\[\/code\]"
    I'm not very good with regular expressions so if anyone can tell me why this doesn't always pick up on the code tags correctly or if anyone can recommend an application that can help generate regular expression patterns it would be really helpful!
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  2. #2
    Fanatic Member
    Join Date
    Feb 2006
    Posts
    607

    Re: Regular Expressions and BBCode Parsing

    I am not sure if you can use this or if its even relevant to you. Today I was working with Regex and headed over to MSDN for documentation when I found out that there are already many derived classes from Regex class.

    Maybe this is some help to you:
    http://msdn.microsoft.com/en-us/libr....tagregex.aspx

  3. #3

    Thread Starter
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: Regular Expressions and BBCode Parsing

    Actually that's pretty cool. That might work much better. Thanks!

    Actually, now that I looked at it, it looks like it only works with tags that have already been created so this won't work for me. I can't seem to find a good set of BBCode regular expressions.
    Last edited by Kasracer; Nov 4th, 2008 at 12:31 AM.
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

Posting Permissions

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



Click Here to Expand Forum to Full Width