Got more questions? Find advice on: ASP | SQL | XML | Windows
Welcome to RegexAdvice Sign in | Join | Help

find if either stringa or stringb do not exist in a string

  •  07-31-2009, 4:37 PM

    find if either stringa or stringb do not exist in a string

    I am working on making a bbcode system with php using preg_replace(), and I am making it so that other tags will not work inside of a code block. This is the code I am currently using, it almost works:

    /(?!\[code\])(.*)(\[b\])(.+)(\[\/b\])(.*)(?<!\[\/code\])/Usi

     what I want it to do is if [*code] and [*/code] are around the text inside, then it won't replace it. But right now it only won't replace when just [*code] is before it.

    so I'm trying to check if [*code] OR [*/code] are around it, but not both, then it will go through to be replaced.

    Does anyone know how I could go about fixing/doing this?

     

View Complete Thread