Community
    • Login

    How to search for words that do **not contain** the character: '

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 3 Posters 2.9k 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.
    • Thomas-OlivierT
      Thomas-Olivier
      last edited by Thomas-Olivier

      How to search for words that do not contain the character: ’
      e.g. white, black?

      accord’s
      black
      D’Arcy
      I’ll
      white

      astrosofistaA 1 Reply Last reply Reply Quote 0
      • astrosofistaA
        astrosofista @Thomas-Olivier
        last edited by

        @Thomas-Olivier

        Assuming a straight single quote ' instead of a curly one, here is a way to get what you want:

        Mark: \b(?<!')\w+(?!')\b
        

        Put the caret at the very beginning of the document, select just the Regular Expression mode and click on Mark All.

        Hope this helps.

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

          Hello, @thomas-olivier, @astrosofista and All,

          @astrosofista, my understanding is slightly different :

          • To get entire line, containing words characters only, use the regex ^\w+$

          • To get entire line, not containing the ' nor the ’ characters, use the regex ^[^'’\r\n]+$

          Test these two regexes against the text below :

          accord’s
          "Program"
          black
          D’Arcy
          and/or
          I’ll
          royalty_free
          machine-readable
          white
          **** NOTEPAD++ LICENSE TERMS ****
          Test
          

          Best Regards,

          guy038

          astrosofistaA 1 Reply Last reply Reply Quote 1
          • Thomas-OlivierT
            Thomas-Olivier
            last edited by

            Thank you, all 3 work.

            1 Reply Last reply Reply Quote 1
            • astrosofistaA
              astrosofista @guy038
              last edited by

              @guy038, All:

              I usually try to understand OP’s messages as literally as possible, unless it is very obvious that there is some mistake, such as the single quotation mark. In this case I read words and thought they were single words, unconnected to each other, but not necessarily on separate lines. Hence the regular expression I posted.

              Nor did it cross my mind that there could be hyphenated compound words, since the posted sample did not include them.

              However, the scenario that you propose is entirely possible and in fact your two regular expressions are simpler than mine. If I were OP, I would choose one of them.

              Have a nice weekend

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