“Regular expressions” are a type of text pattern matching originally developed in the UNIX environment. They can be used as an alternative to vEdit's normal pattern matching. The UNIX specifications are followed very closely. To use regular expressions they must be enabled either by setting CONFIG > Search options > Default search mode to “2” or “3” or by selecting the option ( )Reg-Exp in the Search or Replace dialog box.

The choice between normal pattern matching and regular expressions is partly a matter of personal preference and a consideration of the advantages and disadvantages of each.

Advantages of Regular Expressions

  • For the most part, regular expressions are more flexible and powerful than normal pattern matching. Particularly powerful are the constructs “+” meaning “one or more occurrences of” and “*” meaning “zero or more occurrences of”.
  • During a search and replace, groups of characters matched during the search can be used as part of the replacement text in very flexible ways. This is probably the biggest advantage of regular expressions.
  • If you already know regular expressions from the UNIX environment, you don’t have to learn another searching language.

Disadvantages of Regular Expressions

  • Regular expressions can be lengthy and verbose. For example, the pattern matching code “|A” is equivalent to the regular expression “[a-zA-Z]”.
  • Regular expressions are less flexible for searching multi-line patterns.
  • Many characters have a special meaning in regular expressions. A special syntax must be used when searching for these characters.
  • For the most part, regular expression searching is slower than normal pattern matching searching.
  • Pattern matching has some capabilities not available in regular expressions. For example, “Pattern sets” can match optional items and any one of a set of items.

Regular Expressions

Related Resources