Hi there,
Thanks so much, Justin, for your very helpful comments. They are
greatly appreciated!
I have another question for .NET RegEx experts.
I am reading in a C Sharp file line by line and I am trying to detect
comments that start with either // of ///. What I am particularly
interested is the comments themselves. I am interested in some stats in
regards to the amount of comments in the file (comment bytes).
So, I tried several regular expressions, but they don't seem to work in
all the cases.
Here are the cases that I need to cover:
a. /// comments or // comments
b. /// <xml-tag> comments </xml-tag>
c. /// <xml-tag> comments <another xml-tag> comments </another xml-tag>
comments </xml-tag>
d. /// <xml-tag>
e. /// </xml-tag>
I need to be able to capture the comments and not the xml tags.
Here are a few of regular expressions that I have tried but
unsuccessfully.
@"^.*?///?\s*((</?.+>)*(?<comments>.*))*$"
@"///?\s*(</?.+>)*(?<comments>.*)"
I am having difficulty capturing multiple comments if they are separated
by xml tags. For some odd reason, if I have more than one set of tags,
the returned result is always the right most set of comments.
Thanks so much for any input!
Natalia
*** Sent via Devdex
http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!