Regular Expressions 101

Community Patterns

UNC path

0

Regular Expression
PCRE2 (PHP >=7.3)

/
(\\\\([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\\[-a-zA-Z_ 0-9]+\\)(?:[-a-zA-Z_ 0-9\.]+\\)*
/
gm

Description

Matches a full UNC path, capturing the IP address, share, and full path.

Submitted by Harvey Nash - a year ago