I am using this regex:
[Blah(?:\s*)\]
I want to strip out the tag that looks like:
[Blah:http:..anyting goes here so catch all types of characters ]
Any tips on what's wrong with my regex?
I am using this regex:
[Blah(?:\s*)\]
I want to strip out the tag that looks like:
[Blah:http:..anyting goes here so catch all types of characters ]
Any tips on what's wrong with my regex?
Your regex [Blah(?:\s*)\] starts with an unescaped '[' which is "seen" as the start of a character class. That's what's wrong with your regex (there are probably more errors, but that one is the main reason).
A regex of \[Blah[^\]]*\] is the usual way. It means:
[Blah]]If you want to handle nesting (e.g. input of the form [a[b[c]]]), then you need something other than regex (this is one reason why trying to use regex to parse HTML doesn't work).
Try changing it to \[Blah[^\]]*\] or \[Blah.*?\]. They should give the same result, but there might be a difference in their performance.