E - Give pattern a name.

Syntax:

E(patname)/pattern/

Examples:

e(abc)/xyz/
e(t)/{.*}a {.*}b/
ed/[01234566789]/

Description:

E gives the name (patname) to the specified pattern. The syntax rules for pattern names are the same as the rules for buffer and register names.

Once you have named a pattern, you can refer to that pattern using the construction \E(patname). The parentheses around patname may be omitted if the name is a single character and O-I( is in effect. \E has no special significance when used outside patterns.

If you omit /pattern/ from the command, as in

e(name)

FRED forgets the pattern associated with name. From this point on, \E(name) will no longer match the old pattern.

The command

e(patname)//

associates (patname) with whatever pattern has been used most recently. Thus

s/abc/xyz/
e(name)//

associates name with the pattern /abc/.

Patterns in an E command may contain the \E construction. Recursive definitions are also allowed.

If you use a \E(patname) construction before defining (patname) with an E command, the construction will not match any string. If FRED finds such an undefined construction, it may stop looking for any more matches in the line being examined. This avoids repeated searches with a pattern that is known not to match anything. An undefined \E(patname) construction is thus equivalent to the pattern /#$./.

You may omit the closing delimiter of /pattern/ if O-S/ is in effect and the E command is immediately followed by a new-line.

Copyright © 1998, Thinkage Ltd.