The rules for reading and writing regexes in the ECMAScript dialect are simple. A regex is just a string of characters (such as a[bc].d*e), and you read it from left to right. Most characters represent only themselves, so that cat is a valid regex and matches only the literal string "cat". The only characters that don't represent themselves--and thus the only way to build regexes that represent languages more interesting than "cat"--are the following punctuation characters:
^ $ \ . * + ? ( ) [ ] { } |
\--if you're using a regex to describe a set of strings involving punctuation characters, you can use a backslash to escape those special characters. For example, \$42\.00 is a regex for the singleton ...