Perl-Compatible Regular Expressions (PCRE)
The regular expression syntax of AptEdit is based on the Perl regular expression syntax.

Perl Regular Expression Syntax
In Perl regular expressions, all characters match themselves except for the following special characters: ".", "*", "?", "+", "(", ")", "{", "}", "[", "]", "^", "$" and "\".These characters are literals when preceded by a "\". A literal is a character that matches itself. For example, searching for "\*" will match every "*"in the document, or searching for "File" will match every "File" in the document.

Metacharacters
In particular the following metacharacters have their standard egrep-ish meanings:

\

Quotes the next metacharacter as a special character, a literal, or a back reference. For example, 'n' matches the character "n". '\n' matches a newline character. The sequence '\\' matches "\" and "\(" matches "(".

 
^ Matches only the beginning of the line. For example, "^e" matches any "e" that begins a string.

 
. Matches any single character (except newline). For example, ".e" will match text where any character precedes an "e", like "he", "we", or "me". It never matches a newline unless you use the "/s" modifier.

 
$ Matches the end of the line (or before newline at the end). For example, "e$" matches any "e" that is at the end of line.

 
| Matches either expression of its arguments. For example, "r|pay" matches "r" or "pay". '(r|p)ay' matches "ray" or "pay".

 
() Groups a pattern into a sub-expression. For example the expression "(ab)*" would match all of the string "ababab". To match parentheses characters ( ), use '\(' or '\)'.

 
[abc] A character set. A character set is a bracket-expression starting with '[' and ending with ']', it defines a set of characters, and matches any one of the enclosed characters. For example '[abc]', will match any of the characters 'a', 'b', or 'c'.

 
[a-z] A range of characters. Matches any character in the specified range. For example, '[a-z]' matches any lowercase alphabetic character in the range 'a' through 'z'.

 
[^abc] A negative character set. Matches any character not enclosed. For example, '[^abc]' matches the 'p' in "plain".

 
[^a-z] A negative range characters. Matches any character not in the specified range. For example, '[^a-z]' matches any character not in the range 'a' through 'z'.

 

Quantifiers
The following standard quantifiers are recognized:

*

Matches the preceding character or sub-expression 0 or more times. For example "to*" matches "t", "to" and "too". The "*" modifier is equivalent to {0,}.

 
+ Matches the preceding character or sub-expression 1 or more times. For example,'to+' matches "to" and "too" , but not "t". The "+" modifier to {1,}

 
? Matches the preceding character or sub-expression 0 or 1 time. For example,'to?' matches "t" and "to" , but not "too". The "?" modifier to {0,1}.

 
{n} "n" is a nonnegative integer. Matches exactly n times. For example, 'fo{2}t' matches "foot" only.

 
{n,} "n" is a nonnegative integer. Matches at least n times. For example, 'fo{2,}t' does not match "o" in "fot", but matches foot, fooot, etc. "o{1,}" is equivalent to 'o+'. 'o{0,}' is equivalent to 'o*'.

 
{,n} "n" is a nonnegative integer. Matches up to n times. For example, fo{,3}t matches fot, foot, fooot only.

 
{n,m} "m" and "n" are nonnegative integers, where n <= m. Matches at least n but not more than m times. For example, fo{2,3}t matches foot, fooot only. 'o{0,1}' is equivalent to 'o?'. Note that you cannot put a space between the comma and the numbers.

 

Character Classes
The following character classes are used within a character set such as "[:class:]". For example use [:upper:] to match all the uppercase characters. Note that the [] are part of the [::] construct, not part of the whole character class.
[::]equivalences to Unicode \p{} constructs and equivalent backslash character classes (if available). For example [:digit:], \p{IsDigit} and \d are equivalent.

    POSIX

 Traditional

Unicode

Description
 

    alpha

 

IsAlpha

Any alphabetical character a-z, A-Z, and other character.
 
    alnum   IsAlnum Any alphanumeric character.  
    ascii   IsASCII Any ASCII character.  
    blank   IsSpace Any blank character, either a space or a tab.  
    cntrl   IsCntrl Any control character.  
    digit \d IsDigit Matches a digit character 0-9.  
    ^digit \D IsDigit Matches a non-digit character.  
    graph   IsGraph Any graphical character.  
    lower \l IsLower Any lowercase character.  
    ^lower \L IsLower Lowercase till \E.  
    print   IsPrint Any printable character.  
    punct   IsPunct Any punctuation character.  
    space \s IsSpace
IsSpacePerl
Matches a whitespace character.  
    ^space \S IsSpace Matches a non-whitespace character.  
    upper \u IsUpper Any uppercase character.  
    ^upper \U IsUpper Uppercase till \E.  
    word \w IsWord Matches a "word" character (alphanumeric plus "_").  
    ^word \W IsWord Matches a non-"word" character.  
    xdigit   IsXDigit Any hexadecimal digit character, 0-9, a-f and A-F.

 

Single character escape sequences
The following escape sequences are aliases for single characters:

    \t

Tab character.
 
    \n Newline character.  
    \r Carriage return.  
    \f Form feed.  
    \a Alarm (bell) characer.  
    \v Vertical tab.  
    \e ASCII Escape character.  
    \0dd An octal character code, matches the single character whose code point is 0dd. "dd" is one or more octal digits.  
    \xdd A hexadecimal character code, matches the single character whose code point is 0xdd. "dd" is one or more hexadecimal digits (a Unicode character).  
    \x{dddd} A hexadecimal character code, matches the single character whose code point is 0xdddd. "dddd" is one or more hexadecimal digits (a Unicode character).  
    \N{name}

Named character, matches the single character which has the symbolic name. For example \N{newline} matches the single character \n.

 

Character class escape sequences
The following escape sequences can be used to represent entire character classes:

    \l

Lowercase next character.
 
    \L Lowercase till \E.  
    \u Uppercase next character.  
    \U Uppercase till \E.  
    \w Matches a "word" character (alphanumeric plus "_").  
    \W Matches a non-"word" character.  
    \s Matches a whitespace character.  
    \S Matches a non-whitespace character.  
    \d Matches a digit character.  
    \D Matches a non-digit character.  
    \pP Matches P, named property. Use \p{Prop} for longer names.  
    \PP Matches non-P.  
    \X Matches eXtended Unicode "combining character sequence", equivalent to (?:\PM\pM*).  
    \C Matches a single C character (octet) even under Unicode, equivalent to '.'.  
    \Q Quotes (disable) pattern metacharacters till \E  
    \E

Ends case modification.

 

Zero-width assertions
The following zero-width assertions are defined:

    \b

Matches a word boundary.
 
    \B Matches a non-(word boundary).  
    \A Matches only at the beginning of string.  
    \Z Matches only at the end of string, or before newline at the end.  
    \z Matches only at the end of string.  
    \G

Matches only at pos() (e.g. at the end-of-match position of prior m//g).

 

Extended Patterns
The syntax is a pair of parentheses with a question mark as the first thing within the parentheses. The character after the question mark indicates the extension.
 
    (?#text)

A comment. The text is ignored.
 
      (?imsx-imsx) One or more embedded pattern-match modifiers, to be turned on (or turned off, if preceded by - ) for the remainder of the pattern or the remainder of the enclosing pattern group (if any).  
      (?:pattern) This is for clustering, not capturing; it groups subexpressions like "()", but doesn't make backreferences as "()" does.  
      (?=pattern) A zero-width positive look-ahead assertion. For example, /\w+(?=\t)/ matches a word followed by a tab, without including the tab in $& .  
      (?!pattern) A zero-width negative look-ahead assertion. For example /foo(?!bar)/ matches any occurrence of "foo" that isn't followed by "bar". Note however that look-ahead and look-behind are NOT the same thing. You cannot use this for look-behind.  
      (?<=pattern) A zero-width positive look-behind assertion. For example, /(?<=\t)\w+/ matches a word that follows a tab, without including the tab in $& . Works only for fixed-width look-behind.  
      (?<!pattern) A zero-width negative look-behind assertion. For example /(?<!bar)foo/ matches any occurrence of "foo" that does not follow "bar". Works only for fixed-width look-behind.  
      (?{ code }) This zero-width assertion evaluates any embedded Perl code. It always succeeds, and its code is not interpolated. Currently, the rules to determine where the code ends are somewhat convoluted.  
      (??{ code }) This is a "postponed" regular subexpression. The code is evaluated at run time, at the moment this subexpression may match. The result of evaluation is considered as a regular expression and matched as if it were inserted instead of this construct.  
      (?>pattern) An "independent" subexpression, one which matches the substring that a standalone pattern would match if anchored at the given position, and it matches nothing other than this substring.  
      (?(condition)yes-pattern|no-pattern)) Conditional expression, attempts to match yes-pattern if the condition is true, otherwise attempts to match no-pattern.  
      (?(condition)yes-pattern)

Conditional expression, attempts to match yes-pattern if the condition is true, otherwise fails.

 

Replacement Expressions
The following expressions are available for the Replace With box in the Replace dialog box and in the Replace in Files dialog box.

    \0

Indicates a back reference to the entire regular expression.
 
    \1 - \9 Indicates a back reference - a back reference is a reference to a previous sub-expression that has already been matched. The reference is to what the sub-expression matched, not to the expression itself. A back reference consists of the escape character "\" followed by a digit "1" to "9", "\1" refers to the first sub-expression, "\2" to the second etc.  
    \r A carriage return.  
    \n A new line.  
    \t

A tab.

 
    
Designed for Windows
2000/XP/2003/Vista
 
Download AptEdit Pro
Download AptEdit
Download AptEdit Lite (free)
Download AptDiff (free)
 
  Order AptEdit Pro
  Order AptEdit