Regular expression syntax
From EditPlus Wiki
Revision as of 07:18, 15 July 2008 by WikiSysop (Talk | contribs) (Reverted edits by VaracElbas (Talk); changed back to last version by ElfQrin)
EditPlus supports Regular Expressions in search and replace, but its engine is not as feature-rich as others. A list of common regular expression features not available in EditPlus is available here. Please see Regular Expressions for some commonly used examples.
Operators and Syntax Supported in EditPlus
- \
- escape (\ = \\) used for matching characters that have special meaning as regular expressions
- ^
- (caret) beginning of line (assertion)
- $
- end of line (assertion)
- \t
- horizontal tab (0x09)
- \n
- newline (0x0A or 0x0D or 0x0D+0x0A)
- .
- (period) any character
- ( )
- referencable grouping, see \0 - \9 below, e.g. (foo) matches "foo"
- [ ]
- character class (or-list), e.g. [abc] matches "a", "b", or "c"
- [^ ]
- negated character class, e.g. [^abc] matches a character that is not "a", "b", or "c"
- -
- (minus sign) character range used within character class, e.g. [a-z] matches a character in the range "a" through "z"
- |
- (vertical bar) logical or, e.g. (foo|bar) matches "foo" or "bar"
- *
- (asterisk) match the preceding character or group zero or more times, e.g. foo* matches "fo", "foo", "fooo", etc, but not "f"
- +
- (plus-sign) match the preceding character or group one or more times, e.g. foo+ matches "foo", "fooo", etc, but not "f" or "fo"
- ?
- (question mark) match the preceding character or group zero or once only, e.g. foo? only matches "fo" and "foo"
- \0 - \9
- used in "Replace with" field to represent text matched with parenthesis (\0 = whole match, \1 - \9 = submatches), no back-references
- &
- When used in the "Replace with" field, the entire match is replaced. To replace with an actual ampersand, you must escape it \&
Operators and Syntax Not Supported in EditPlus
Some common regular expression syntax/operators not available in EditPlus:
- foo{num}
- match foo exactly num times
- foo{min, max}
- match foo at least min and at most max times, both optional
- \a
- 0x07, BEL
- \f
- 0x0C, formfeed
- \r
- 0x0D, carriage return, see \n
- \e
- 0x1B, ESC
- \xfoo
- 0xfoo, hexadecimal character reference
- \cfoo
- control-foo
- \s
- whitespace character, use [ \t\n]
- \S
- non-whitespace character, use [^ \t\n]
- \d
- decimal digit, use [0-9]
- \D
- not a decimal digit, use [^0-9]
- \w
- word character, letter, for English use [A-z]
- \W
- non-word character, non-letter, for English use [^A-z]
- [[:alpha:]], [[:lower:]], [[:upper:]], [[:alnum:]], [[:digit:]], [[:xdigit:]], [[:punct:]], [[:graph:]], [[:print:]], [[:blank:]], [[:space:]]
- predefined character classes (POSIX)
- \b
- word boundary (assertion)
- \B
- not a word boundary (assertion)
- \A
- subject start (assertion), use ^
- \Z
- subject end (assertion), use [\n$]
- \z
- subject end (assertion), use $
- assertions other than ^ and $
- parts of patterns that are not added to matches:
- (?=foo)
- positive assertion
- (?!foo)
- negative assertion
- (?<=foo), (?<!foo)
- look-behind assertion
- (?>=foo), (?>!foo)
- look-ahead assertion, once-only sub-pattern
- (?(foo)true), (?(foo)true|false)
- conditional sub-pattern, foo being either the number of a sub-pattern or an assertion
- (?:foo)
- grouping, non-referencable
- (?ifoo), (?mfoo), (?sfoo), (?xfoo)
- inline modifiers
- (?R)
- recursive pattern
- (?#foo)
- comment
Workaround
A user tool, Full RegEx Supported Replace and More has been developed that adds full regex support to EditPlus.