Regular expressions are string expressions which are used to identify matching patterns in other strings. Many languages and environments implement regular expressions, often with small differences. Regular expressions first gained large-scale use on unix systems in conjunction with tools such as grep, awk, and sed.
Simple Examples[edit | edit source]
Example 1. literal (no special characters used)[edit | edit source]
Matches the string "hello" only.
Example 2. any character.[edit | edit source]
the "." character matches any character except newline (\n).
Matches "an!", "and"
Example 3. zero-or-more characters.[edit | edit source]
the "*" character matches any string zero or more of the character immediately preceding it.
Matches "hel", "hellll"
External Links[edit | edit source]
- Regular Expressions on Wikipedia
- Java Trail: Regular Expressions
- "Regular-Expressions.info - Regex Tutorial, Examples and Reference - Regexp Patterns" for many languages