1) Java identifier: A java identifier can contain letters, digits, underscores, and $. It must START with a non-digit. [A-Za-z_$] // first character of variable [\w$]* // the remainder of the characters Full expression: [A-Za-z_$][\w$]* // one way to write it. [\w$&&[^\d]][\w$]* // another way to write it. ------------------- 2) Clock time: Hours value can be a 1-digit number (non-zero): [1-9] OR it can be a 10, 11, or 12: 1[0-2] Minutes can be a 2-digit number from 00-59: [0-5][0-9] (or) [0-5]\d AM or PM can easily be expressed like this: [ap]m So the full expression: ([1-9]|(1[0-2])):[0-5]\d [ap]m ----------------------------- 3) IP address (trickier) Form is A.B.C.D, where each of A, B, C, D are values from 0 - 255 1-digit number: [0-9] or \d 2-digit number: [1-9][0-9] or [1-9]\d 100-199: 1[0-9][0-9] or 1\d{2} 200-249: 2[0-4]\d 250-255: 25[0-5] OR all of these together to get the value of one of the number positions \d|([1-9]\d)|(1\d{2})|(2[0-4]\d)|(25[0-5]) The period needs to be escaped (because it has its own meaning as a regular expression pre-defined character class otherwise) \. Now, do the above expression with a period following it. Repeated 3x. Then the above expression once more: ((\d|([1-9]\d)|(1\d{2})|(2[0-4]\d)|(25[0-5]))\.){3} // first 3x Final expression: ((\d|([1-9]\d)|(1\d{2})|(2[0-4]\d)|(25[0-5]))\.){3}(\d|([1-9]\d)|(1\d{2})|(2[0-4]\d)|(25[0-5]))