Z
Zeba
Hi guys,
I need some help regarding regular expressions. Consider the following
statement :
System.Text.RegularExpressions.Match match =
System.Text.RegularExpressions.Regex.Match(requestPath, "([^/]*?\
\.ashx)");
(where requestPath is a string)
1. What does the regex:
[ ^ / ] * ? \ \ . ashx
(no spaces between the special characters in actual expression)
actually do ? How come * and ? occur consecutively ?
2. Doesn't '?' require some text/block of text before it ?
3. Is the expression read left to right or right to left ?
i.e. is the backslash grouped as ' \ \ ' . or \ ' \ .' ? If it is
the
former, why is it not written as \ \ \ . and if latter what does the
orphaned backslash do ?
Hope that's not too many questions - I'm too confused !
Thanks !
I need some help regarding regular expressions. Consider the following
statement :
System.Text.RegularExpressions.Match match =
System.Text.RegularExpressions.Regex.Match(requestPath, "([^/]*?\
\.ashx)");
(where requestPath is a string)
1. What does the regex:
[ ^ / ] * ? \ \ . ashx
(no spaces between the special characters in actual expression)
actually do ? How come * and ? occur consecutively ?
2. Doesn't '?' require some text/block of text before it ?
3. Is the expression read left to right or right to left ?
i.e. is the backslash grouped as ' \ \ ' . or \ ' \ .' ? If it is
the
former, why is it not written as \ \ \ . and if latter what does the
orphaned backslash do ?
Hope that's not too many questions - I'm too confused !
Thanks !