Mailing List archive

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

[vdr] Re: RE-Micro-FAQ



> Sorry for all non-germans, I've only written a german-version.
Did a quick translation:


Readears that are familiar with perl regular expressions can skip this file :-)

Something on terms and definitions:
Regular expressions are abbreviated "RE" in the following.

Processing a RE is called "matching"

A RE is a pattern that is matched with a string.
If a RE "matches", the pattern matches completely with the test-string.


e.g:
Title: "Star Trek: Deep Space Nine"
RE: "Deep Space Nine"
Is a hit since the RE appears completely in the test string.

1) Wildcards
The most important wildcard is the period (.). A period matches everything (*1)
 \s	A whitespace (for Master-Timer this is a blank)
 \S	Not whitespace (everything except whitespace)
 \d	Decimals (0 - 9)
 \w	Alphanumeric characters (a-z 0-9.)
 
2) Quantifiers
A quantifier ensures that the pattern left of it matches multiple times or not at all.
 
 ?	Matches 0 oder 1 times
 *	Matches 0 or more times
 +	Matches 1 or more times
 {x,y}	Matches x to y times

Whereas you can leave out x or y, 0 is used of x and infinite for y then.

Example:
 a?	0 or 1 times "a"
 .+	1 or more arbitrary character(s)
 b{4,5}	4 or 5 times the character "b"

The most important for most cases thus is ".*" or ".+"

3) "Anchor"
An anchor means matching a certain state.
 
 ^	Start of line (must be the first character of the RE)
 $	End of line (must be the last character of the RE)
 
Example:
 Titel: "Star Trek: Deep Space Nine"
 RE:	"^Star Trek"
 or
 RE: 	"Space Nine$"
 or
 RE:	"^Star Trek: Deep Space Nine$"



 *1: For Master-Timer the exceptions are not relevant.


-- 
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index