devicode Site Admin
Joined: 05 Mar 2005 Posts: 249
|
Posted: Wed Apr 13, 2005 3:38 am Post subject: What is a regular expression? |
|
|
Question
What is a regular expression?
Answer
ResponseMailer allows you to specify the method to use when evaluating a filter condition. You can choose to use :
Normal - for simple words and pharses
Wildcards - for words and pharses with missing letters
Regular Expreession - for complex words and phrases
Regular Expression
- A regular expression is a compact way of describing complex patterns in texts.
- It is a formula for matching strings that follow some pattern.
- A regular expression is a pattern describing a certain amount of text.
- A regular expression is a text pattern consisting of a combination of alphanumeric characters and special characters known as metacharacters. A close relative is in fact the wildcard expression which are often used in file
Here are a few examples
- |
A vertical bar separates alternatives. For example, "gray|grey" matches grey or gray.
- A quantifier after a character specifies how often that character is allowed to occur. The most common quantifiers are +, ?, and *:
- +
The plus sign indicates that the preceding character must be present at least once. For example, "goo+gle" matches the infinite set google, gooogle, goooogle, etc.
- ?
The question mark indicates that the preceding character may be present at most once. For example, "colou?r" matches color and colour.
- *
The asterisk indicates that the preceding character may be present zero, one, or more times. For example, "0*42" matches 42, 042, 0042, etc.
- ( )
Parentheses are used to define the scope and precedence of the other operators. For example, "gr(a|e)y" is the same as "gray|grey", and "(grand)?father" matches both father and grandfather.
Additional links on Regular Expression
Learning to Use Regular Expressions by Example
A Tao of Regular Expressions
Regular expression, From Wikipedia
Regular Expression Basics
Regular Expressions explained |
|