Regular Expressions 101

Community Patterns

Unix file with full path

1

Regular Expression
Golang

`
((\.{2}\/{1})+|((\.{1}\/{1})?)|(\/{1}))(([a-zA-Z0-9]+\/{1})+)([a-zA-Z0-9])+(\.{1}[a-zA-Z0-9]+)?$
`

Description

Find all string matches with dir, one or more subdir, file name with optional extension.

Common example with all capturing groups included:

../../dir/SubDir1/SubDir2/file.ext

Note that Full path can begins with ./ or / patterns.

Submitted by anonymous - 4 years ago