In Java the String class has a method called matches that is very helpful when checking if an expression is valid. The method takes a String as a parameter which is the regular expression. Examples of regular expressions can be found in the Java api by clicking on the regular expression link of the method summary for matches in the String class.
So for example in regex square brackets '[]' are used to group together different letters and there are also other operators like '+' which means the expression has to appear once or more or '*' which means the expression can appear zero or more times.
Also if you are using JGrasp, under the Tools tab is a regular expression tester that allows you to test regex. I suggest trying a few things like "(ab)" "(a*b)" "[ab]" "[ab]*".
Enjoy! Let me know what you think.