Menu

RegExp -- why no "[a-z]{3,6}"?

2008-03-20
2012-11-13
  • Jim Henderson

    Jim Henderson - 2008-03-20

    Hello,

    I've just downloaded Notepad++, and it does everyhing I want, EXCEPT why can't I do the standard RegExp thing with
       [a-k]\{3,6\}
    to select from 3 to 6 of the previous thing?

    This is standard RegExp in Unix from way back when, and egrep introduced
       [a-k]{3,6}
    to have the same effect. Perl regular expressions have adopted the same standard.

    In Linux commands, both forms are available, often with the Perl version specified with the command-line argument
       -r
    or
       --regexp-extended

    There are other differences between the basic and extended RegExps.

    I'm sure there are open source libraries that notepad++ could use to implement the Perl version of RegExps, and to my mind this would be a great advance. (The style of regular expressions used could be controlled by a tick box somewhere.)

    After all, even Microsoft Word supports [a-k]{3,5} in its "wildcard" searches!

    How could I suggest this change to the maintainers of notepad++?

    Jim

     
    • DV

      DV - 2008-03-20

      All RegExp handling comes from Scintilla (SciLexer.dll). If you have any suggestions, please contact the Scintilla's project authors.

       
      • Jim Henderson

        Jim Henderson - 2008-03-22

        I did contact the Scintilla forum, but Neil Hodgson (nyamatongwe) said:
        <<<<<<
        I believe that applications that want good regular expression support
        should link their preferred RE library into their executable. That way they
        get to choose which library to use. I won't be adding to the existing RE
        code myself although may accept well written patches.
        >>>>>>

        So now I'm in a bind. I have experience in programming in C and Perl and Unix shell, but never for a windowing environment. I have fetched the helps on developing a plugin for npp, but with my other workloads, I doubt that I'll be able to put the time into learning to write a plugin.

        I've just sent an email to Chris Severance, the developer of TextFX directly, to see if he would be prepared to make the full RE as in Perl etc available in TextFX, so I'll be content to see what he says.

        Thanks again for listening,
           Jim

         
        • M. B. Huffman

          M. B. Huffman - 2008-03-22

          Have a look at PCRE - Perl Compatible Regular Expressions at http://www.pcre.org/
          The source code can be compiled with various compilers, including Visual C++

          Mike

           
          • Nobody/Anonymous

            The main problem of implementing PCRE together with Scintilla is that basicly PCRE works with raw strings, and Scintilla don't allow low-level access to strings itself - it uses Accessor class instead, which allows to get a single character or a COPY of some substring... But there's also an ability in PCRE to redefine string to some custom class... So... If someone feel good enogh to write a good wrapper of Scintilla's Accessor class for PCRE - I think not only the Notepad++ community will be VERY thankfull to him :)

             
    • Don HO

      Don HO - 2008-03-20

      Please see :
      http://notepad-plus.sourceforge.net/uk/regExpList.php

      However, you're welcome to do the plugin to support RE you want.

      Don

       
    • Nobody/Anonymous

      Scintilla is a cross-platform component and, when we talk about Regular Expressions, we are talking about clear C++ without any platform-specific code. So you can make a patch for Scintilla without any problems.

       
MongoDB Logo MongoDB