Character Patterns []
[ ] matches a single character and/or range that is contained within the brackets. To match [ ] as-is, escape it \[\]. However, the [ and ] symbols are by default not included in the character set and will not be indexed and therefore not found. If you want to be able to search on these symbols, please contact support (http://help.zylab.com).
The - character (used in the character range) is treated as a literal character if it is the last or the first character within the brackets: [abc-], [-abc].
Backslash escapes are allowed in sequence search and bracket expressions. Wild cards *, ?, + do not have a special meaning inside [ ]. For example, a search 'a[abc*?+]m' will match characters in range as-is, so terms 'abm' 'a*m', or 'a+m' will return a match.
Semantics |
Recommended Use |
|
---|---|---|
[character(s)]
|
Where one or more characters are placed between two brackets. |
Use it to match one character. |
[character- range] |
Where a character range is placed between two brackets. |
Use it to match one character from a range of characters. |
Processing Rules
Sequence Rule
|
[abc] |
The sequence characters are matched one at a time. For range [abc], 'a' is matched, then 'b', then 'c' |
Range Rule |
[a-c] |
The range matching is inclusive, i.e. for the pattern [a-k]pple, both words 'apple' and 'kpple' qualify. A valid range is defined as [c1 - c2] where c1 <= c2. For example, 'a-c' is a valid range but 'c-a' is not. 'a-' is a valid range too. This will match 'a' or '-'. |
Negation Rule |
^ (caret) |
The caret (^) has a special meaning only inside the square brackets and only if it is the first character to follow the open square bracket, '['. Caret negates characters within the square brackets when it is the first character. If '^' is not the first character within the square brackets, it loses its special meaning and is matched directly as an ordinary character. |
The following wild card range patterns match the word 'apple':
[abc]pple |
character sequence |
[a-k]pple |
character range |
[a]pple |
one-character sequence |
[^b]pple |
caret (^) negates characters in sequence and/or range |
Examples
Example of query |
Results |
---|---|
[abc] |
'a', 'b', and/or 'c'. But also, 'c-omputer'. |
m[ae]n |
'man' and/or 'men' |
m[a-e]n |
man, mbn, mcn, mdn, men |
m[a-z]n |
All terms with three letters that start with an m and end with an n. |
[a-z] |
any single lowercase letter from 'a' to 'z' |
[abcx-z] or [a-cx-z] |
'a', 'b', 'c', 'x', 'y', and/or 'z' |
[a-z][a-z][a-z][a-z][a-z] |
All terms with 5 letters. Also, hyphenated terms of which at least one part has 5 letters or less. For example 'c-omputer'. |
[a-z][a-z][0-9][0-9][a-z][a-z] |
All terms that start with 2 letters and are followed by 2 numbers and 2 letters. |
[-abc]
|
'-', 'a', 'b', and/or 'c'. But also, 'c-omputer'. |
[abc-] |
'-', 'a', 'b', and/or 'c'. But also, 'c-omputer'. |
[a-]pple |
Matches 'apple' and '-pple' |
[c-a]pple |
Not a valid range. Error returned: 'Query contains an invalid wild card pattern.' |
[0-9] |
any natural number from '0' to '9' |
[a^bc] |
'a', 'b', 'c'. But also, 'c-omputer'. The ^ sign will not be found because it is not indexed by default. You can change this by adjusting the character set. Please contact http://help.zylab.com |