[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[webmasters] mora it skoz

For some of the configuration options, a rudimentary knowledge of
Perl-style regular expressions will help you get the best out of
Majordomo A regular expression is a concise way of expressing a pattern
in a series of characters. The following describes simple use of
regular expressions. There is an O'Reilly Associates book called
Mastering Regular Expressions if you want to find out more. Any book on
Perl will also contain information about regular expressions. 
The character / used to mark the beginning and end of a regular
expression. Letters and numbers stand for themselves. Many of the other
characters are symbolic. Some commonly used ones are: 

\@ the '@' found in nearly all addresses; it must be preceeded by a
backslash to avoid errors 
. (period) any character 
* previous character, zero or more times; note especially... 
.* any character, zero or more times 
+ previous character, one or more times; so for example... 
a+ letter "a", one or more times 
\ next character stands for itself; so for example... 
\. literally a period, not meaning "any character" 
^ beginning of the string; so for example... 
^a a string beginning with letter "a" 
$ end of the string; so for example... 
a$ a string ending with letter "a" 

Some examples: 

Notice the periods are preceded by a backslash to make them be
literally periods. This matches any string containing cs.umb.edu such


The "@" must be prefixed with a backslash to avoid errors. The string
".*" means "any character, zero or more times". So this regexp matches
any string containing rouilj before the "@", and cs.umb.edu after it: 


but it doesn't match 


This is similar to Example 2, and matches the same first two strings: 


but it doesn't match 

because the regular expression says the string has to begin with letter
"r" and end with letter "u", by using the ^ and $ symbols, and neither
of those is true for this string. 

This regular expression matches anything. 

Here the "*" is preceded by a "\", so it refers literally to an
asterisk character and not the symbolic meaning "zero or more times".
The "." still has its symbolic meaning of "any one character", so it
would match, for example: 


It would not match this because the "." by itself implies one


Normally all matches are case sensitive; you can make any match case
insensitive by appending an "i" to the end of the expression. This
regexp would match aol.com, AOL.com, AoL.cOm, etc. Removing the "i"
would match aol.com but not AOL.com or any other capitalization. 

Ther are four configuration options which must be specified as regular

[Configuration Page | Mailing Lists Home Page] 


[Oxford University Home Page | OUCS Home Page | Search OUCS pages |


Date: 20th March 1998
 Oxford University Computing Services. 

Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.