Appendix E. Regular Expressions

jEdit 4.3pre5 and later uses regular expressions from java.util.regex.Pattern to implement inexact search and replace. Click there to see a complete reference guide to all supported meta-characters.

A regular expression consists of a string where some characters are given special meaning with regard to pattern matching.

Inside XML files

Inside XML files (such as Jedit mode files), it is important that you escape XML special characters, such as &, <, >, etc. You can use the XML plugin's "characters to entities" to perform this mapping.

Inside Java / beanshell / properties files

Java strings are always parsed by java before they are processed by the regular expression engine, so you must make sure that backslashes are escaped by an extra backslash (\\)

Within a regular expression, the following characters have special meaning:

Positional Operators

One-Character Operators

Character Class Operator

Subexpressions and Backreferences

Branching (Alternation) Operator

Repeating Operators

These symbols operate on the previous atomic expression.

Stingy (Minimal) Matching

If a repeating operator (above) is immediately followed by a ?, the repeating operator will stop at the smallest number of repetitions that can complete the rest of the match.