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)\R in the Find dialog box will give you an Invalid regular expression error, while using a RegEx of \R will 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 :

    And, probably, this issue was fixed since the regex library 5.1.3, of the Boost C++ libraries v1.66.0 ( or v1.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 \R syntax with the sequence \r\n ( or possibly \n ), in the search regex !



    P.S. :

    After some tests, I don’t think that other regex syntaxes become bugged, when using the free-spacing mode ( (?x) ) !

Log in to reply