So I'm working on a very rudimentary BB Code parsing component that will be used by a handful of people. I'm very bad at regular expressions but I was able to piece several together from internet examples as well as direct copy and paste from other places. They don't seem to consistently work. So my questions are thus:
  1. Can these regular expressions be improved and if so how? Are they fundamentally broken or missing pieces?
  2. What's a good resource where folks can learn about regular expressions from the ground up and then utilizing them in C#?


The following is a set of static properties that have defined regular expressions in them for parsing [P], [I], [B], [STRIKE], [CODE], [IMG] (includes ALT text and works like [URL]), [QUOTE], and [URL].
Code:
public static Regex P { get { return new Regex(@"\[p\](.+?)\[\/p\]", RegexOptions.IgnoreCase); } }
public static Regex I { get { return new Regex(@"\[i\](.+?)\[\/i\]", RegexOptions.IgnoreCase); } }
public static Regex U { get { return new Regex(@"\[u\](.+?)\[\/u\]", RegexOptions.IgnoreCase); } }
public static Regex B { get { return new Regex(@"\[b\](.+?)\[\/b\]", RegexOptions.IgnoreCase); } }
public static Regex Strike { get { return new Regex(@"\[strike\](.+?)\[\/strike\]", RegexOptions.IgnoreCase); } }
public static Regex Code { get { return new Regex(@"\[code\](.+?)\[\/code\]", RegexOptions.IgnoreCase); } }
public static Regex Image { get { return new Regex(@"\[img=([^\]]+)\]([^\]]+)\[\/img\]", RegexOptions.IgnoreCase); } }
public static Regex Quote { get { return new Regex(@"\[quote=([^\]]+)\]([^\]]+)\[\/quote\]", RegexOptions.IgnoreCase); } }
public static Regex Url { get { return new Regex(@"\[url=([^\]]+)\]([^\]]+)\[\/url\]", RegexOptions.IgnoreCas
e); } }