I am creating a regex to see if the copyright info at the top of all documents is formated correctly.
The copy right is long therefore my regex is long too.
Lets say that the copy right info looks like:
/*/////////////////////////////////////////////////////////////////////////
Copyright content which is a lot goes in here.
Programmer: Tono Nam
/////////////////////////////////////////////////////////////////////////*/
Then I will use the regex:
var pattern =
@"/\*/////////////////////////////////////////////////////////////////////////
Copyright content which is a lot goes in here.
Programmer: (?<ProgammerName>[\w '\.]+)
/////////////////////////////////////////////////////////////////////////\*/";
If I apply the regex to the first text it will give me a match everything is great. the problem is when the regex does not matches Let's say that a programmer placed an extra /
at the top. My regex will not match anymore. With this example it is simple to notice but the real copyright is much longer and it will be nice to know where is the error. Or sometimes there are mispelled errors. For example you might encounter Programer instead of Programmer. Just because of that I will have to look into the whole copyright and try to discover the error. I think there should be a simpler way of doing what I need
Edit
If the subject happens to be:
/*/////////////////////////////////////////////////////////////////////////
Copyright content which is a lot goes in here SOME_MISPELED_WORD.
Programmer: Tono Nam
/////////////////////////////////////////////////////////////////////////*/
then the regex will not match because of SOME_MISPELED_WORD
therefore I will like to know the index where the error occurred so that I can look at:
/*/////////////////////////////////////////////////////////////////////////
Copyright content which is a lot goes in here <-------------- here
instead of the whole thing.
Another example would be if the copyright info is:
/*/////////////////////////////////////////////////////////////////////////
Copyright content which is a lot goes in here.
Programmer: Tono Nam
//////////////////////////////////////////////////////////////////////////*/
I will like to get an error at the last line because there is an extra /
.