I have a C++ source file containing many functions.
I want to find the beginning of every function quickly.
How can I form an expression for )newline{newline
?
The newline
symbol can be either one of the following:
\n
\r
\n\r
\r\n
Presumably, the same symbol is used all across the file, so instead of a single expression for all options combined, I need a single expression for each option.
I assume that a regular-expression can be used, but I'm not sure how.
Thanks
Barak, before we look at individual options, for all options, this will do it:
\)[\r\n]+{[\r\n]+
The [\r\n]
is a character class that allows either of \r
or \n
. It is quantified with a +
which means we are looking for one or more of these characters.
You said you want individual options, so this can be turned to:
\)\r\n{\r\n
\)\r{\r
\)\n{\n
\)\n\r{\n\r
(this sequence of newlines is quite surprising)
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