Regular expression syntax documentation
A regular expression is a way to describe a pattern of text to be matched. Special characters in a regular expression are:
. [ ] - ^ * ? + $
|
Regular expression |
Effect |
|
. (period) |
Matches any single character. Example: "sampl." would match "sample" or "samplZ" |
|
^ (caret) |
Matches the start of a line |
|
$ |
Matches the end of a line |
|
\ |
Treat next character literally. Example: in "\$100", the indicates that the pattern is "$100", not end-of-line ($) followed by "100" |
|
[abc] |
Brackets indicate a set of characters, one of which must be present. For example, "sampl[ae]" would match "sample" or "sampla", but not "samplx" |
|
[a-z] |
Inside brackets, a dash indicates a range of characters. For example, "[a-z]" matches any single lower-case letter. |
|
[^a-z] |
Indicates any character except the ones in the bracketed range. |
|
.* (period, asterisk) |
An asterisk means "0 or more" of something, so .* would match any string of characters, or nothing |
|
.+ (period, plus) |
A plus means "1 or more" of something, so .+ would match any string of at least one character |
|
[a-z]+ |
Any sequence of one or more lower-case letters. |
|
Copyright (c) 1995-2008 dtSearch Corp. All rights reserved.
|