Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
~
^(file:\/\/\/)?(?<root>[a-zA-Z][:|\|])
~
gm
Input 1
1
New
file:///C:/Users/username/example.txt Matches: Group 'root': C: Windows URI without File Protocol: C:\Projects\file.txt Matches: Group 'root': C: Windows URI with Forward Slashes: file:///D:/Data/Documents/test.docx Matches: Group 'root': D: Windows URI with Different Drive Letter: E:\Photos\vacation.jpg Matches: Group 'root': E: Windows URI with Special Characters: file:///F:/My%20Documents/report.pdf Matches: Group 'root': F: Windows URI with Vertical Bar Separator: file:///G:|/Movies/action.mp4 Matches: Group 'root': G: Does not match: \Users\username\file.txt file:///A@:/path/to/file.txt http://example.com/path/to/file.txt
Extraction
file:///C:/Users/username/example.txt Matches: Group 'root': C: Windows URI without File Protocol: C:\Projects\file.txt Matches: Group 'root': C: Windows URI with Forward Slashes: file:///D:/Data/Documents/test.docx Matches: Group 'root': D: Windows URI with Different Drive Letter: E:\Photos\vacation.jpg Matches: Group 'root': E: Windows URI with Special Characters: file:///F:/My%20Documents/report.pdf Matches: Group 'root': F: Windows URI with Vertical Bar Separator: file:///G:|/Movies/action.mp4 Matches: Group 'root': G: Does not match: \Users\username\file.txt file:///A@:/path/to/file.txt http://example.com/path/to/file.txt