O+S - Set string and pattern options.

Syntax:

O+S&      O-S&      Set "&" option in S
O+S/      O-S/      Is final "/" necessary?
O+SD      O-SD      Case duality option
O+Sccc    O-Sccc    Set pattern characters

Examples:

o+sd
o-s&
o-s[^$+
o-s/

Options:

ccc
is a list of one or more characters that can have special meaning in patterns.
O+SD
tells the FRED pattern matcher to ignore whether letters are in upper or lower case. This is the default. For example, under this option /this/ will match THIS, This, tHIs, this, and so on. O+SD applies to matching patterns in S, G, T, ZL, ZU, and ZT commands, as well as to searches for strings.
O-SD
tells FRED to pay attention to upper and lower case in pattern matching. Under this option, /this/ will match only a lower case this.
O+S&
lets you use the & character on the right hand side of S commands as a shorthand for the pattern matched. For example,
s/AB/&C/

will change all AB strings into ABC. This is the default.

O+S& also allows you to use brace brackets to tag portions of patterns, as in

s/me{ow}a/ba-wa/

For the scope of this one S command only, occurrences of the letter a on the right hand side of the S are taken as shorthand for the string matching the pattern inside the braces. Thus the given command is equivalent to

s/meow/bow-wow/
O-S&
disables these two features, so that & and the single character names following brace brackets to be treated like ordinary characters.

If O+S& is in effect, \C& can be used on the right hand side of an S command to refer to an & without its special meaning; and if a tag t is used in a {pattern}t construction, \Ct may be used to refer to t itself on the right hand side of an S command. For example,

s/me{ow}a/ba-w\Ca/

turns meow into bow-wa.

If O-S& is in effect, \O& on the right hand side of an S command refers to the special meaning of &, not & itself.

O+Sccc
tells FRED to use the special meanings of the characters ccc... whenever they appear in a pattern. The following characters may have special meanings for pattern matching.
{ ( [ . * ^ $ | \E + @ # -

Note that ] is not in this special character list, since ] is special only when it follows [. Similarly, we have omitted } and ). The - in the list refers to the ability to use ranges in [string] constructions.

O+S can enable the special meanings of these characters. For example, O+S.*{ enables the special meanings of ".", *, and { in pattern matching. O-S disables the special meanings of the list of characters which come after it.

The default options are

O+S^$.*[\E-
O-S{(|+@#

\C can turn off the special meaning of enabled characters and \O can turn on the special meaning of disabled characters.

O-S/
lets you omit the final delimiter on an S command. For example, you would be able to say
s/pattern/string

With O-S/ in effect, FRED effectively treats the new-line at the end of the line as a closing delimiter. O-S/ also allows the closing delimiter to be omitted in line searches (e.g. /....), in E commands, in G commands which have no command-list, in jump commands like JM and JP, and in T, ZL, ZT and ZU.

The default is O+S/, which means that the closing delimiter is required.

Description:

O+S and O-S set the condition register TRUE if any of the options they are turning on or off were previously on, and FALSE if all the options were previously off. This is useful when writing buffers that may have different string options from those in a user's init buffer.

If you use an E command to associate a name with a pattern, the options that pertain to the pattern are the ones that were in effect when the E command was issued. For example, if (yy) is defined with

E(yy)/[1234567890]/

\E(yy) will always match a digit, even if [ is later turned off by O-S[. Similarly, if O+SD is in effect when you say

E(xx)/this/

\E(xx) which match this, THIS, This, etc. even if the O-SD option is set later.

Copyright © 1998, Thinkage Ltd.