If you click in Find or Replace dialog on button Help or press key F1, the appropriate help page opens. The help pages for the Find and Replace dialogs contain both the links to
- Regular Expressions help page listing and explaining briefly in two tables all special characters of UltraEdit and Unix regular expression engine. On this page you can read also about the meaning of ^(...^) in search string and the corresponding reference ^1 in replace string. A bit better explained is that expression on power tip page about tagged regular expressions.
- Perl Regular Expressions help page explaining and listing the commonly used Perl expressions. This page does not list all possibilities and expressions which can be used with the Perl regexp engine as this fills books or entire websites as those listed on forum announcement Readme for the Find/Replace/Regular Expressions forum.
Explanation for search string
"^([~"
^p]^)^p" and replace string
"^1 ":
With
^(...
^) the string found by the expression inside the escaped parentheses is remembered internally for every replace in a string variable. Up to 9 such tagging or marking groups can be used within a search string. The contents of the up to 9 string variables holding parts of a found string are referenced by
^1 to
^9. Such a tagged expression is used if a part of a found string should be kept unchanged in replace or moved to another position within entire found string. In comparison to the UltraEdit regexp engine just
(...
) must be used for defining a tagging group with Unix/Perl regexp engine and if round brackets should be found, they must be escaped with a backlash in Unix/Perl syntax.
[...
] defines a character class, i.e. a set of characters. For example
["3
^t] means that either a double quote charater OR character
3 OR a
tab character must be found. With
~ immediately after opening square bracket the character class definition becomes a negative definition. So
[~"
^p] means find a character which is whether a double quote character, NOR a carriage return (CR), NOR a line-feed (LF).
^p is replaced internally by
^r^n wherever used in an UltraEdit regular expression search or replace string.
So the entire search string
"^([~"
^p]^)^p" means:
- Find a single character which is whether a double quote nor a CR nor a LF and remember this character in the string variable 1,
- and next 2 characters are a CR+LF pair
and replace the found string by the found character before CR+LF and a space character instead of the CR+LF pair.