Professional Documents
Culture Documents
!!!!!!!!!!!!!!!!!!!!!!!!!!!!
The Regular Expression search option 'x' allows you to specify complex
search patterns when searching through buffers or strings. Option 'x'
can be specified in both end-user search prompts and macro language
searching functions (such as 'find' and 'replace').
Each operator matches a pattern. There are operators which allow you
to anchor searches to the beginning or end of a line, match any
character, match a class of characters or its complement, optionally
match a pattern, match one of several patterns, match repeating
patterns, and match groups of patterns.
Operator Description
!!!!!!!! !!!!!!!!!!!
thes|m|r| |e
// matches 'these', 'theme', 'there', or 'the e'
{apples}|{oranges}|{bananas}
// matches 'apples', 'oranges', or 'bananas' (see below
// for a description the grouping operator '{}')
fo*bar
// matches 'fbar', 'fobar', 'foobar', 'fooobar', etc.
apples.*oranges
// matches any string starting with 'apples' and ending
// with 'oranges':
a.@z
// matches a string starting with 'a' and ending with
// 'z', for the longest possible string
'.@'
// matches a single-quoted string for the longest
// possible string
[a-zA-Z]#
// matches the first occurrence of one or more
// alphabetic characters, for the longest string
// possible
string2#
// matches 'string2', 'string22', 'string222', etc.
// (matching the longest possible string)
{apples}|{oranges}
// matches 'apples' or 'oranges'
another{ fine}? mess
// matches 'another mess' or 'another fine mess'
{ab}#
// matches 'ab', 'abab', 'ababab', etc.
{{ab}|{xy}}#
// matches 'ab', 'xy', 'abab', 'abxy', 'xyab', 'abxyab',
// etc.
apples\++oranges
// matches 'apples+oranges', 'apples++oranges', etc.
whats all this then\?
// matches "whats all this then?"
c:\\file\.?txt
// matches 'c:\filetxt' or 'c:\file.txt'
The '\' operator can also be used to match specific
characters:
For example:
\t\t
// matches two tab characters
\x00|\r
// matches a binary zero or a return character
// (Ascii 13)
{ |\x09}+$
// matches trailing whitespace (blanks and tabs)
{if}|{else}|{for}|{while}|{switch}|{return}|{break}
// matches a few 'C' language keywords
[a-zA-Z0-9_]#
// matches identifiers in most languages
^ *{function}|{key}.*$
// matches AML function headers
[a-zA-Z0-9_]# *= *[0-9]#
// matches statements of the form: variable = number
Operator Description
!!!!!!!! !!!!!!!!!!!
^ match the beginning of a line
$ match the end of a line
. match any character
[ ] specify a characters class
[ - ] specify a range of characters
[~ ] specify the complement of a character class
? optionally match the preceding pattern
| the alternation ('or') operator
* match zero or more of the preceding pattern (min closure)
+ match one or more of the preceding pattern (min closure)
@ match zero or more of the preceding pattern (max closure)
# match one or more of the preceding pattern (max closure)
{ } define a group or tag a pattern
\ literal operator, or reference a tagged pattern
\a match the alert or beep character (Ascii 7)
\b match the backspace character (Ascii 8)
\f match the formfeed character (Ascii 12)
\n match the newline or linefeed character (Ascii 10)
\r match the return character (Ascii 13)
\t match the tab character (Ascii 9)
\v match the vertical tab character (Ascii 11)
\xHH match the hexadecimal character 'HH'