7.1
Table Of Contents
- Introduction
- How to
- Common Tasks
- Company Tasks
- Publication Type and Document Tasks
- Add publication types
- Modify the publication type properties
- Delete a publication type folder
- Adding documents to a publication type
- Delete documents from a publication type
- Edit document properties
- Manage production settings
- Output options
- Manage linked files
- Setting up web forms
- Define file upload settings
- Setting up pricing
- Image Collection Tasks
- Order Manager Tasks
- Ordering workflow
- Settings
- General Settings
- Pricing and Ordering
- Production
- Modules
- Enabling B2C (Business to Customer)
- Introduction to Regular Expressions
11.1 Syntax
The following sections describe the basic regular expression syntax.
Character selection
Regular expressions can contain both special and ordinary characters. Most ordinary characters, like "A", "a",
or "0", are the simplest regular expressions; they simply match themselves. You can concatenate ordinary
characters, so last matches the string 'last'.
• [] Matches a single character that is contained within the brackets. For example, [abc] matches "a", "b",
or "c". [a-z] matches any lowercase letter. These can be mixed: [abcq-z] matches a, b, c, q, r, s, t, u, v,
w, x, y, z, and so does [a-cq-z]. The '-' character should be literal only if it is the last or the first
character within the brackets: [abc-] or [-abc]. To match an '[' or ']' character, the easiest way is to
make sure the closing bracket is first in the enclosing square brackets: [][ab] matches ']', '[', 'a' or 'b'.
• [^ ] Matches a single character that is not contained within the brackets. For example, [^abc] matches
any character other than "a", "b", or "c". [^a-z] matches any single character that is not a lowercase
letter. As above, these can be mixed.
• ( ) Defines a "subexpression".
• . Matches any single character. Within [ ] this character has its normal (literal) meaning. For example,
"a.cd" matches "abcd", "a..d" matches "abcd" but [a.cd] matches "a" or "." or "c" or "d".
• \d Any digit 0-9
• \D Any non-digit
• \s Any whitespace character (this is equivalent to the set [ \t\n\r\f\v])
• \S Any single non-whitespace
• \w Any letter, number or underscore (this is equivalent to the set [a-zA-Z0-9_])
• \W Any char except letter, number or underscore
• \t ASCII Horizontal Tab (TAB)
• \n ASCII Linefeed (LF)
• \r ASCII Carriage Return (CR)
• \f ASCII Formfeed (FF)
• \v ASCII Vertical Tab (VT)
Alternation
A vertical bar separates alternatives. For example, "gray|grey" can match "gray" or "grey".
Grouping
Parentheses are used to define the scope and precedence of the operators. For example, "gray|grey" and
"gr(a|e)y" are different patterns, but they both describe the set containing gray and grey.
Quantification
A quantifier after a character or group specifies how often that preceding expression is allowed to occur. The
most common quantifiers are ?, *, and +:
• ? The question mark indicates there is zero or one of the preceding element. For example, colou?r"
matches both color and colour.
• * The asterisk indicates there are zero or more of the preceding element. For example, ab*c matches
"ac", "abc", "abbc", "abbbc", and so on.
• + The plus sign indicates that there is one or more of the preceding element. For example, ab+c
matches "abc", "abbc", "abbbc", and so on, but not "ac".
Objectif Lune Inc. © 2010 153