Folder path - regex

Hellow everyone…
i have to validate a my folderpath field…
could you people suggest any reqular expression to validate a valid
path…
that field should not accept input like “My Documents”
but should accept “c:\Backup”
i searched the web and i tried this…
Regular Expression:
^((([a-zA-Z]:)(\{2}[a-zA-Z]+)(\{2}\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}))(?=(\(\w[\w
])))(\\w[\w ])*)$
.but was not usefull…
pls favour for me…
Thanks for any helps

On Jun 20, 11:41 am, Newb N. [email protected]
wrote:

Hellow everyone…
i have to validate a my folderpath field…
could you people suggest any reqular expression to validate a valid
path…
that field should not accept input like “My Documents”
but should accept “c:\Backup”

You’re going to have to be a little more precise: what is it that you
are trying to ensure? No spaces, no special characters, absolute paths
only, something else ? Also what about platforms where paths are
delimited in different ways ? What will you be doing with this path ?

Fred

Frederick C. wrote:

On Jun 20, 11:41�am, Newb N. [email protected]
wrote:

Hellow everyone…
i have to validate a my folderpath field…
could you people suggest any reqular expression to validate a valid
path…
that field should not accept input like �My Documents�
but should accept �c:\Backup�

You’re going to have to be a little more precise: what is it that you
are trying to ensure? No spaces, no special characters, absolute paths
only, something else ? Also what about platforms where paths are
delimited in different ways ? What will you be doing with this path ?

Fred

thanks for the reply
in that folder path location i m going to save files.
and i m on windows …

Newb N. wrote:
[…]

in that folder path location i m going to save files.

On the client side? For security reasons, Web applications don’t have
direct access to the client-side filesystem. You’ll have to give the
client a download link and let the browser program take care of saving
it

OTOH, if this is on the server side, you can construct the path in a way
that you know will be valid.

In either case, there is no point to the validation you’re trying to
do.

and i m on windows …

Doesn’t mean your clients will be, so you can’t only accept
Windows-style paths!

Really, there’s no validation that can do what you want here.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]