Reputation: 14108
Goal:
The first letter shall be a small or a big character only and after that, the data ":\\" is should follow along. Data ":\\" is static.
Problem:
I have problem with my regex code.
^[a-zA-Z]:*$
Info:
C:\\dd\\sd\\faf.txt true
c:\\ss\\dw\\fbf.txt true
D:\\ff\\d3\\fcf.txt true
d:\\da\\ds\\Df\\ff.txt true
2:\\ad\\dd\\ff false
2:\ad\\dd\\ff false
d:\da\\ds\\Df\\ff.txt false
c\\ss\\dw\\fbf.txt false
D:\da\\ds\\Df\\ff.txt false
Upvotes: 1
Views: 49
Reputation: 3502
You need to detect correct PATH format in Windows.
Using this pattern can help: ^[a-zA-Z]:(\\\\[^\\]+)*
You can check my sample. Also note I add one more test to it:
D:\\da\\ds\Df\\ff.txt false
Upvotes: 1