File & Path

Hidden File (Dotfile)

Matches Unix-style hidden files (dotfiles) like .gitignore or .env.

Try it in RegexPro

Pattern

regexJavaScript
/^\.[^.\s/\\][^/\\]*$/

Raw source: ^\.[^.\s/\\][^/\\]*$

How it works

`^\.` requires leading dot. `[^.\s/\\]` requires the next character to not be another dot, whitespace, or slash. `[^/\\]*$` allows any additional non-slash characters.

Examples

Input

.gitignore

Matches

  • .gitignore

Input

.env.local

Matches

  • .env.local

Input

..

No match

Common use cases

  • File system tools
  • Git utilities
  • Config discovery