Regular Expressions: Overview

Search & Replace regex2 shg Regular Expressions Overview

Regular Expressions are used for advanced searches, where the search string follows a rule and is not always exactly the same. Regular Expressions employ “special character operators,” which are symbols that control the search, and “an expression,” which is a combination of meta characters and operators that specify a pattern. Regular Expressions can be used in replacements, they can make use of Binary Characters, Special Replacement Operators, Environment Variables, & Math Operations, and they can be case sensitive or not. You can also change the number of bytes to allow for regular expressions under Search Options.

Important: To use regular expressions you must activate regular expression mode by clicking on the toolbar button or selecting Regular Expressions in the Flags Menu. If Regular Expression is dim, make sure HTML Mode &/or Ignore Whitespace are turned off.

Search and Replace uses a Regular Expression syntax that is a subset of UNIX grep notation for Searching and DOS style Batch file %n input parameter notation, with extensions, for Replacing. The major differences between the Search and Replace and grep regular expressions are:

. operator is not supported

* + ? ! operators must precede an expression enclosed by () or []. Otherwise, the operator is assumed to match any/all characters from beginning of line or to the end of the line. For example, if used in Search and Replace, the grep expression [123]* would match the numbers plus everything to the end of the line. The Search and Replace counterpart is *[123], which would match just the numbers.

^ and $ cannot be used within a single search string. Unix grep can use expressions such as ^just_this$ to locate a string that is the only thing on a line. The Search and Replace counterpart is: ^just_this\r\n

Regular Expression Help Topics

Search Operators

Replacement Operators

Examples

Literal Characters

Special Replacement Operators

Regular Expressions Overview