Regexp - Dot (Single Character pattern)



Dot . in a regular expression matches any character in the supported character set with this characteristic, by default:

Dot has no special meaning in a character class.


Match Newline (DOTALL)

Dot does not match newlines by default, a modifier must be set when running the matching function.

Java Example with the DOTALL flag:

  • A pattern that capture the content between two XML nodes even if there is new line in there.
Pattern pattern = Pattern.compile("<top>(.*?)</top>",Pattern.DOTALL);

Stop at

last occurrence (Greedy mode - default)

Dot will match all character with the default greedy matching mode.

First Occurrence (Lazy)

If you want to made it lazy, you need to add a ? after the quantifier. See Regular Expression - (Lazy|Reluctant) Quantifier



.at matches any three-character string ending with at, including:

  • hat,
  • cat,
  • and bat.

Exclude newlines from the negation

With dot all, a common mistake is to assume that a negated character set like [^#] will also not match newlines.

In order to exclude newlines, they must be added to the set.

Example: Every characters that is not ( # and Linux EOL \n) will be expressed as:


Documentation / Reference

Discover More
Notepad Eol
Examples on how to replace a text in Notepad++ with regular expression

A step by step tutorial and snippets on how to replace a portion of text in notepad++ with regular expression
Color Autocompletion List
How to create an Autocompletion functionality with CSS, Javascript and HTML

This article shows you how to create a search box with an autocompletion feature
How to use Regular expression (Regexp) in Javascript?

This page is regular expression in Javascript code unitssingle-character pattern (.) The pattern enclosed between slashes. Loaded compilation (only when the script is loaded) Runtime compilation...
Card Puncher Data Processing
Php - Regular expressions (Perl-compatible)

in Php are an implementation of Perl (PCRE) with the PCRE library (See ). Therefore, the syntax for patterns used in these functions closely resembles to Perl (PCRE) but not totally. See reference.pcre.pattern.differencesPerl...
Regexp - (Flag|Modifier)

Flag or modifier changes the behavior of the parsing and therefore of the match. A dot may matches new line or not. You specify it by specifying a flag. Java Example with the java/util/regex/PatternDOTALL...
Regular Expression - Meta-(symbols|characters) - Operator

There are two different sets of meta-characters: those that are recognized anywhere in the pattern except within square brackets, and those that are recognized in square brackets. Operator...

Share this page:
Follow us:
Task Runner