The first expression, [(A|M)*], matches any string containing any of the symbols "(", "A", "|", "M", ")" or "*"; the second [(A|M)]*] matches any expression containing zero or more of the symbols "(", "A", "|", "M" or ")"; the third is the same as the second except one or more match is required.
To do what I think you want to do, the correct expression is [AM]+.
Last edited by PTrenholme; 03-03-2009 at 07:57 AM.
|