I can’t get my regex to match the header of a c# code file.
I basically want need to return the header if it exists.
Example:
#define debug
//****************************************************************************************************
// <copyright file="" company="">
// Copyright (c) . All rights reserved.
// </copyright>
// <project>Engine</project>
//****************************************************************************************************
code here
//some other comment here
more code here
//another comment here
My regex looks like this:
(?:/\\*(?:[^*]|(?:\\*\+[^*/]))*\\*\+/)|(?://.*)
but it only matches this line:
//**********************************************************
and not the rest of the comment.
Comments can also end like this "*/".
whats wrong with my regex? why doesn’t it catch the whole block?
Try this one – and you can pull out the entire comment (with the “//” or the group within to get just the text. This will return a match for each line. Please use the “Multiline” option to run this: