(→Related Resources) |
|||
| (2 intermediate revisions by the same user not shown) | |||
| Line 30: | Line 30: | ||
;\@(r) | ;\@(r) | ||
:Use the contents of text register ‘r’ in this position in the search (or replace) string. | :Use the contents of text register ‘r’ in this position in the search (or replace) string. | ||
| + | |||
| + | ==The OR Operator== | ||
| + | |||
| + | The special character “|” is the “OR” operator which may occur between two sub-expressions. The entire expression then matches any text that is matched by the preceding sub-expression OR the following sub-expression. Note: “|”cannot occur within “'''{ }'''”; each sub-expression must by itself be a valid expression. | ||
| + | |||
| + | <div class="callout note"> | ||
| + | “'''|'''” is the “pipe” character, which is <kbd>Shift-\</kbd> on the keyboard. | ||
| + | |||
| + | ;man|woman | ||
| + | :Matches the word "man" '''OR''' the word "woman" | ||
| + | ;a+|b+ | ||
| + | :Matches one or more occurrences of "a" '''OR''' of "b" | ||
| + | </div> | ||
==Related Resources== | ==Related Resources== | ||
| + | *[[Regular_Expressions|Regular Expressions Overview]] | ||
| + | *[[Regular_Expressions_Basics|Regular Expressions Basics]] | ||
| + | *[[Special_Matching_Characters#The_OR_Operator|The “OR” Operator]] | ||
| + | *[[Groups_Replacement_Strings|Groups and Replacement Strings]] | ||
| + | *[[Groups_Replacement_Strings#Groups_and_Replacement_Examples|Groups and Replacement Examples]] | ||
| + | *[[Regular_Expressions_Newline|Matching the “Newline”]] | ||
| + | *[[Maximize_Regular_Expression|Maximize Regular Expression Matching]] | ||
The following special matching characters are defined. They can be used in both the search string and replacement string of a regular expression.
The special character “|” is the “OR” operator which may occur between two sub-expressions. The entire expression then matches any text that is matched by the preceding sub-expression OR the following sub-expression. Note: “|”cannot occur within “{ }”; each sub-expression must by itself be a valid expression.
“|” is the “pipe” character, which is Shift-\ on the keyboard.