To avoid newline characters as part of the capture, you can search for:
\\brief\s*([^\n\r])+
You can replace with <summary>$1</summary>
The [^\n\r]
is a negated character class that matches any character that is neither a newline nor a carriage return. By adding the +
quantifier, we manage to match the whole line.
What were the problems with the original?
- the
.\s
is the first problem. The dot matches the space character, then there is no space left to match for the\s
- the
?
in the[\r?\n]
serves no purpose. It does not make the\r
optional, but says that a literal question mark is one of the allowable chars to be matched at that position. - the
{1}
is redundant, as a[charclass]
only matches one character unless it is followed by a quantifier.