Community
    • Login

    Search characters if exist in any order with no spaces?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 2 Posters 76 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.
    • maxxseeM
      maxxsee
      last edited by

      Hello!

      I want to find all instances of certain characters together even if jumbled order with a fixed letter or string of letters at end

      example

      search for <+., or +<,. and so on, find all instances if contain
      with the letter or string becomes
      <+.,hello or +<,.hello
      (don’t search for +< ., where the space fails the test)
      to recap search for all characters in any order [<+.,]hello (with hello in order)

      How does one do this in notepad++?

      Would love to also only search beginning of lines of text (^\h* as is used in regular expression search)

      Help is appreciated! Thanks

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @maxxsee
        last edited by PeterJones

        @maxxsee ,

        Generic Regex: Logic Gates for Regular Expressions shows how to use logic in your search/replace, like requiring all the desired terms in no particular order, or one term or another, or other boolean-logic operators. So that should give you a place to start.

        ----

        Useful References

        • Please Read Before Posting
        • Template for Search/Replace Questions
        • Formatting Forum Posts
        • Notepad++ Online User Manual: Searching/Regex
        • FAQ: Where to find other regular expressions (regex) documentation
        maxxseeM 2 Replies Last reply Reply Quote 0
        • maxxseeM
          maxxsee @PeterJones
          last edited by

          @PeterJones said in Search characters if exist in any order with no spaces?:

          Hi I did some digging into your text but sadly a bit too hard for me

          These are the most I could do currently

          ([<+.,])(^ h)*hello

          (?-s)(?:(?=.*[<+.,])(?=.hello))^.(?:\R|\z)

          but neither produced the correct results - first one worked better but it found results with extra characters in the four characters which was unwanted

          1 Reply Last reply Reply Quote 0
          • maxxseeM
            maxxsee @PeterJones
            last edited by

            @PeterJones
            actually did solve it by excluding line, wow… almost gave up

            (?-s)(?:(?=.[<+.,])^.(?:\R|\z)(?=.hello))(?!.([aaa]|[bbb]))^.*
            where the aaa and bbb are the characters not wanted in search results

            feel free to post better simpler solution, thanks!

            1 Reply Last reply Reply Quote 0
            • PeterJonesP
              PeterJones
              last edited by


              Moderator Note: Please do not delete posts after the conversation has happened. It removes context.

              (Moderator restored deleted posts; topic being locked, because it appears the original poster is no longer interested, since the posts were deleted)

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