Q:

Regex help with sample pattern. C#

I decided to use Regex, now I have two problems :)
Given the input string "hello world [2] [200] [%8] [%1c] [%d]",
What would be an approprite pattern to match the instances of "[%8]" "[%1c]" + "[%d]" ? (So a percentage sign, followed by any length alphanumeric, all enclosed in square brackets).
for the "[2]" and [200], I already use 
Regex.Matches(input, "(\\[)[0-9]*?\\]");

Which works fine.
Any help would be appreicated.

A:

The Regex needed to match this pattern of "[%anyLengthAlphaNumeric]" in a string is this "[(%\w+)]"
The leading "[" is escaped with the "\" then you are creating a grouping of characters with the (...).  This grouping is defined as %\w+.  The \w is a shortcut for all word characters including letters and digits no spaces.  The + matches one or more instances of the previous symbol, character or group.  Then the trailing "]" is escaped with a "\" and catches the closing bracket.
Here is a basic code example:
string input = @"hello world [2] [200] [%8] [%1c] [%d]";
Regex example = new Regex(@"\[(%\w+)\]");
MatchCollection matches = example.Matches(input);

