How to use OR in regular expression?

2006-10-27
2012-11-13
  • Nobody/Anonymous

    It is not work using OR in regular expression (e.g. (ABC|CDE) ) for searching in the file.
    Is Notepadd++ not support this, or something else?

     
    • Nobody/Anonymous

      I am not sure, but I think not. You could search in another way.

      Try:  [A-E]

      It's not the best but you should also find the correct words.

      Regards
      Jens

       
      • Thomas Steininger

        This is no solution and a worse style.
        why you don't support the standard with abc|xyz?

         
        • Nobody/Anonymous

          I agree. Why must every program have its own interpretation of what regular expression is?

          N++ should adopt the closest to widely used standard (POSIX?) to regex.

           
          • Nobody/Anonymous

            It' scintilla and not notepad. I am agree, too! But all Editors with scintilla uses this regex style. An additional implementation for PCRE or other libs takes time.

            Best Regards
            Jens

             
            • GerdB

              GerdB - 2008-11-24

              How about using scintilla with PCRE? It seems that scintilla now supports different egex engines (see http://www.scintilla.org/ScintillaDoc.html "Building with an alternative Regular Expression implementation").

               
              • korisu

                korisu - 2009-06-12

                +1! I've been thinking this for a long while, and it'd be awesome to see some follow-up for it. I hate having to start up RegexBuddy just because I have to do a search/replace that's too complicated for Scintilla's engine. Could we please get some push for this in the main build?

                 
    • Nobody/Anonymous

      Thanks for your reply.
      But [A-E] only search the single character, I want to search the whole world, i.e. (world1|world2).

       
    • Nobody/Anonymous

      Yea, you are correct. Therefore try this:

      [A-E]+

      or

      [AC][BD][CE]

      Regards
      Jens

       
    • GerdB

      GerdB - 2008-11-25

      Followup: I managed to "borrow" the Regex engine from Programmers notepad ( http://www.pnotepad.org/ ) which uses boost::xpressive. In particular, I built SciLexer.dll using http://pnotepad.googlecode.com/svn/trunk/pnwtl/scintilla/RegexSearch.cpp and thus replaced Scintilla's own RESearch. Hope to see this in the Notepad++ trunk one day.

      Gerd

       
      • cchris

        cchris - 2009-05-16

        +1

        CChris

         
      • Don HO

        Don HO - 2009-06-22

        Very attractive.
        However, I see the boost header in "RegexSearch.cpp".
        How do you link with boost library (dynamic or static) ?

        Don

         
    • cchris

      cchris - 2009-06-22

      Isn't Change Markers doing that already?

      CChris

       
  • Lorenzo Monti

    Lorenzo Monti - 2010-09-26

    can you kindly provide more details of how you did it?
    thank you - Lorenzo -

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks