[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: 

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


cs.umb.edu
foo.cs.umb.edu
user@foo.cs.umb.edu
users%foo.cs.umb.edu@greatcircle.com


/rouilj\@.*cs\.umb\.edu/ 
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: 


rouilj@cs.umb.edu
rouilj@terminus.cs.umb.edu
arouilj@terminus.cs.umb.edu@greatcircle.com

but it doesn't match 


rouilj@umb.edu
brent@cs.umb.edu


/^rouilj\@.*cs\.umb\.edu$/ 
This is similar to Example 2, and matches the same first two strings: 


rouilj@cs.umb.edu
rouilj@terminus.cs.umb.edu

but it doesn't match 


arouilj@terminus.cs.umb.edu@greatcircle.com 
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. 


/.\*rouilj/ 
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: 


a*rouilj
s*rouilj

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


*rouilj 

/aol\.com/i 
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
expressions: 


advertise 
noadvertise 
taboo_body 
taboo_headers 
[Configuration Page | Mailing Lists Home Page] 



--------------------------------------------------------------------------------


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



--------------------------------------------------------------------------------


Date: 20th March 1998
 Oxford University Computing Services. 

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/