Sunday 15 July 2012

c# - Parse directories from a string -


At first I spent three hours trying to solve it. Also, please do not recommend using regex. I appreciate other comments and can easily use other methods but I am practicing as much as possible regex.

I am using VB.Net

Example string:

  "Hello world This is a string c: \ example \ test e : \ Other Example "  

Pattern:

 " [az] {1}: + [[]] ""  < / Pre> 

How many times does the directory name have a white space? I have tried to match all those stars that begin with 1 uppercase letter, followed by a colon and then Anything. This is a white space, 1 upper degree R and a colon need to be matched.

How about "[AZ] {1 }: ("[? AZ] {1} :).) *", What should be stopped before the next drive letter and colon?

That "?!" Is a "negative framework" or "zero -Choathai is the negative lookhead ", which is around the lack of inverse matching in regedx.

No comments:

Post a Comment