Community
    • Login

    Bug: Regular Expressions [^\v]* not working as expected

    Scheduled Pinned Locked Moved General Discussion
    3 Posts 3 Posters 2.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Sebastian ProskeS
      Sebastian Proske
      last edited by

      When I use search with regular expressions, I would expect [^\v]* to match a whole line until the linebreak - but it matches the whole document. However \v works fine, as does \V - am I expecting wrong or is this a bug?

      Claudia FrankC 1 Reply Last reply Reply Quote 0
      • Claudia FrankC
        Claudia Frank @Sebastian Proske
        last edited by

        Hello @Sebastian-Proske,

        seems that \v is used for vertivcal tab.

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 0
        • guy038G
          guy038
          last edited by guy038

          Hello Sebastian,

          First of all, sorry for my late reply :-(

          There a particularity of the BOOST Regex ligrary, about the regex syntax \v :

          • The regex \v represents any vertical blank character, that is to say one character which belongs to the range [\n\x0B\f\r]

          • The regex [\v] represents, ONLY, the vertical tabulation character, of Unicode code \x0B

          So, when you write [^\v], it matches any single character, which is different from the \x0b ( VT character )

          Thus, your regex [^\v]* represents any set, even empty, of characters, different from the Vertical Tabulation character, included any End Of Line character ( \r, \n or \r\n)

          In other words, if your current file does NOT contain any \x0b character, your regex [^\v]* matches, absolutely, all the characters of the file. Quite logical !

          Best Regards,

          guy038

          P.S. :

          The regex \V ( Uppercase v ) is equivalent to the range [^\n\x0B\f\r], that is to say any single character, different from a Vertical Tabulation, from a Form Feed character and from an EOL character.

          Again, if your file does NOT contain any \x0b and/or \x0c character(s), the regex \V+ matches successively, each whole line, without its line break !

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors