Building a multi-line RegEx
glennfromiowa last edited by
Rather than open an old thread, I thought I’d start a new one. I was using the method discussed by @guy038 to build a multi-line RegEx, when the Notepad++ Find box gave me a message that I had an invalid regular expression. I narrowed it down to using the any line ending character sequence \R character escape along with the Ignore unescaped whitespace (?x) flag.
Interestingly enough, using a RegEx of
(?x)\Rin the Find dialog box will give you an Invalid regular expression error, while using a RegEx of
\Rwill not. Could this be a bug in the current Boost C++ Regex library? Although I wanted to share that combination to avoid with the community, I also wonder if anyone else has come across any other characters or parts of a RegEx that are invalid when used in conjunction with the (?x) flag?
guy038 last edited by guy038
Hello, @glennfromiowa and All,
I’m totally sorry for my very late reply ! I’ve just missed that post :-((
You’re perfectly right on that matter. Indeed, it’s a Boost regex library bug ! Refer to these two links for explanations :
And, probably, this issue was fixed since the regex library
5.1.3, of the Boost C++ libraries
Of course, we’ll have to live with that tiny bug… as N++ is using the regex component of Boost library
However, we just have to be aware of that fact and, IF using the
(?x)modifier, simply replace any
\Rsyntax with the sequence
\r\n( or possibly
\n), in the search regex !
After some tests, I don’t think that other regex syntaxes become bugged, when using the free-spacing mode (