Finding clips using regular expressions – 360 Systems Image Server 2000 User Manual

Page 54

Advertising
background image

Page 54

Image Server 2000 Owner’s Manual

Finding Clips Using Regular Expressions

A regular expression (or RE) specifies a pattern to be matched in a clip name.
Regular expressions can contain both special and ordinary characters. Ordinary characters just
match themselves. Thus, the RE “

night

” would match the “night” in the clip name “Tonight Show”,

so this and any other clip name with “night” in it would be placed in the list of found clips.

The following special characters are supported:

.

(dot) This matches any single character. “a.c” matches “abc”, “aac”, “a2c” and “a c” but
not “acd”.

^

(caret) This matches the start of a clip name. To find all clips starting with “xyz”, for
example, use the Regular Expression “^xyz”.

$

Match the end of the clip name. To find all clips ending in “xyz” use the RE “xyz$”.

<

Match the beginning of a word. For example “<Show” will match all clip names
containing a word that starts with “Show”, such as “Now Showing”, but not “LateShow”.

>

Match the end of a word.

*

Match zero or more repetitions of the preceding character. G*N “.*” will match anything –
“G.*N.*” will match “Georgia Evening News” or “Good Night”

+

Match 1 or more repetitions of the preceding RE.

?

The preceding Regular Expression term is optional. “ab?c” will match “ac” or “abc” but not
“adc”.

[ ]

Used to indicate a set of characters. Characters can be listed individually, or a range of
characters can be indicated by giving two characters and separating them by a "-". Special
characters are not active inside sets. For example, [a+$] will match any of the characters
"a", "+", or "$"; [a-z] will match any lowercase letter, and [a-zA-Z0-9] matches any letter or
digit. If you want to include a "-" inside a set, precede it with a backslash, or place it as the
first character. You can match all characters that are not within the set by making "^" as the
first character of the set; "^" elsewhere will simply match the "^" character. For example,
[^7] will match any character except "7".

SPACE A space is treated as an ordinary character. “ Show “ (<space>Show) will match “Tonight

Show” but not “Now Showing” or "NewShow”. “ “ will match any clip with a space in the
name.

The subject of Regular Expressions is much larger than can be completely covered here. They are
used in several different operating systems and programming languages. Further information can be
found on the internet and in books on Regular Expressions and Linux.

Advertising