Javascript Regular Expressions

Regular expressions are a type of value that can match with strings.

A regular expression or regex is bracketed by backslashes. The regex below can match with strings containing "abc". You can also create a regex with the RegExp constructor. Regexes can use the test method to determine if a string contains a match. You can also use regexes with a string's search method. You can extract the pattern that matches your regex with string's match method. You can extract an array of matches with the "g" modifier. Certains characters, called tokens, have special meaning in regexes. For example, a period will match any single character. Some tokens are "modifiers". For examle, a "+" will match one or more of the preceding character. A "?" modifier will match zero or one of the preceding character. And a "*" will match zero or more of the preceding character. Repeated invocations of the exec method will eventually return all matches. This can lead to errors if you use the same RegExp object with different strings. regex.exec will keep trying to find matches until it runs out and then returns null.