Hi,
I need Regular Expression for validate file path, In My case regex will accept both "/" and "\" ,
I tried all possibilities , but no one is working. it accepts URL also, So please Help Me to do this Validation
Thanks & Regards!!!!
-=Arun Prasath=-
Loading
arun prasathPosted Jul 3, 2012, 5:09 AM
Jignesh TrivediPosted Jul 3, 2012, 2:59 AM
In Above post, I already combine Box Regex.
it work for both url as well as file path.
var f = Regex.IsMatch("D:\\JigneshTest\\", @"^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))|[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}$");
Let me know if you have any query on same.
arun prasathPosted Jul 3, 2012, 2:35 AM
Jignesh TrivediPosted Jul 3, 2012, 1:23 AM
For achieve both together combine both.
var f = Regex.IsMatch("D:\\JigneshTest\\", @"^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))|[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}$");
hope this will help you.
arun prasathPosted Jul 3, 2012, 1:16 AM
User Need to enter file path....after that we want validate is this valid file path or not...
Pls Help me Friends...
Thanks & Regards!
-=Arun=-
Jignesh TrivediPosted Jul 2, 2012, 11:57 PM
if you only validate file Path then try..
var f = Regex.IsMatch("D:\\JigneshTest\\", @"^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))$");
or URL validation
^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}$
hope this will help you.
Suthish NairPosted Jul 2, 2012, 1:18 PM