I am looking for consistency in my projects. But I don't always remember that it when I am typing. This leads me to an issue when I have commented half of my project and I don't know if I ended all the lines with a .
So, I'd like to find all the summaries that does not end with a dot to remedy this. An example of this is:
/// <summary>
/// This is my summary
/// </summary>
This means that there is starting white spaces, always three /
and they are all enclosed within a <summary>
tag.
I started working on it and got this:
^///$[^\.]
based on
^ start of line
/// the three slashes
$ end of line
[^\.] that doesn't end with a dot.
But I fail to get it to work. How do I find all the summary lines that does not end with a .?
You do not need to anchor to the start of the string, as it is the '///' that marks the the start of a comment line
///.*[^\.]$
how we build this up.
we know that the comments we are looking for start with '///' and end with not '.', those two strings can be matched as '///' and '[^.]' in between we can have anything, so '.*'
You do not need a '^' at the start, as a comment does not have to start at the start of the string/line.
You might also want to account for trailing white space, so
///.*[^\.]\s*$
I might have missed a few other points, so just shout up
what does $
mean
The '$' symbol in regex is an anchor for the end of the string. It sort of matches new lines, except (perhaps depending on implementation) it can match simply the end of input. It works the same as '^' which matches the start of input
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With