I'm not familiar with the use of double quotes in regexes. However, you seem to have the right idea. Instead of quotes, try using \\ in place of each \ you want to match. E.g.:

^\\(\\[A-Za-z0-0_-]+)+\\?$

Quick explanation

\\ - Must start with a single backslash

(\\[A-Za-z0-0_-]+) - A pattern representing a backslash followed by one or more valid letters/numbers/symbols. If - is the last character in a [ ] block, it loses its special meaning and just matches -.



The pattern is wrapped in () and specified to occur 1 or more times with +.

Finally, there's a trailing \\? saying the path may optionally end with \. Don't know if you want that or not.

NOTE: this pattern won't allow "\\". Don't know if that matters.

K.C.

Daniel Massie wrote:

I am trying to write a regular expression to represent a network path.
Network paths are of the form
\\path\to\folder
The regular expression which I thought would achieve this is
^"\"{2}([A-Za-z0-9]"-_")+"\"{1}([A-Za-z0-9]"-_\")+$
But I am having no luck. Can anyone help?

Thanks

Daniel Massie


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to