Sets of characters |
Top Previous Next |
Scripts > Token definitions > Regular expressions > Sets of characters
A set of characters can match any single character that is a member of the set. Sets are delimited by "[" and "]" and can contain literals, character ranges or predefined character classes.
The characters ".|*?+(){}$", which have a Meta meaning within the regular expressions, have their literal meaning within the definition of character classes, i.e. no backslash must be put in front of them here.
Set declarations that start with "^" contain the compliment of the elements that follow.
Examples:
Character literals:
"[abc]" will match either of 'a', 'b', or 'c'.
"[^abc]" will match any character other than 'a', 'b', or 'c'.
Character ranges:
"[a-z]" will match any character in the range 'a' to 'z'.
"[^A-Z]" will match any character other than those in the range 'A' to 'Z'.
Combinations:
All of the above and character sets and symbolic names can be combined in one character set declaration, for example:
[[:digit:]a-c[.NUL.]].
To include a literal '-' in a set declaration then: make it the first character after the opening '[' or '[^', the endpoint of a range precede with an escape character as in '[\-]'. To include a literal '[' or ']' or '^' in a set then make them the endpoint of a range, or preceded with an escape character.
|
This page belongs to the TextTransformer Documentation |
Home Content German |