Regex . — Any Single Character

. matches any single character except newline. With the /s (DOTALL) flag it also matches newlines. Example: /./ on "a\nb" matches a and b.

Open the interactive DevRef Hub tool →

Key facts

Token.
DefaultAny char except \n
With /sAlso matches \n
Example/./ on "a\nb" → ["a","b"]

Frequently asked questions

What does . match in regex?

Any single character except a newline by default.

How do I make . match newlines?

Use the /s (DOTALL / single-line) flag.

Related pages

Regex . — Any Character is part of DevRef Hub on GOAT Lab — a free reference you can use without signing up, and it works offline. Open the tool above for any custom value.

Advertise

Part of GOAT Lab — 26 free, browser-based science, engineering and developer tools. No sign-up.