I'm working on an expression that finds comments which begin with % and end with \n or \r and also multiple line comments /* */. I'm running into trouble for the one beginning with %. I can get it to detect when the comment starts but it is not terminating with a new line.
"(%.*\\n\\r)|(/\\*(?:.|[\\n\\r])*?\\*/)"
For example, if I have
%hello
nothing nothing nothing
fi
It takes the nothing nothing nothing line as a comment but not the fi line. I'm so confused.