Building a multi-line RegEx
-
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? -
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 :
https://svn.boost.org/trac10/ticket/12960
https://github.com/boostorg/regex/commit/a32e0cc9d39f8c0886fe5576022c7bf0c9efc265
And, probably, this issue was fixed since the regex library
5.1.3, of the Boost C++ librariesv1.66.0( orv1.67.0)
Of course, we’ll have to live with that tiny bug… as N++ is using the regex component of Boost library
v1.55.0!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 !Cheers,
guy038
P.S. :
After some tests, I don’t think that other regex syntaxes become bugged, when using the free-spacing mode (
(?x)) !
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login