• Login
Community
  • Login

Regex to find any lines that do NOT have a specific number of a character

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
30 Posts 7 Posters 10.3k 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.
  • A
    Alan Kilborn @Mark Yorkovich
    last edited by Sep 11, 2019, 5:48 PM

    @Mark-Yorkovich said:

    Alan’s exp doesn’t match anything in my file

    Well, if I copy and paste your “lorem ipsum” data (above) into a new tab and then run my regex (above) on it, I get lines with exactly 9 pipes redmarked, which I thought was the goal (or the inverse of the goal):

    Imgur

    So…I really don’t know where the disconnect is…

    1 Reply Last reply Reply Quote 0
    • A
      Alan Kilborn @Mark Yorkovich
      last edited by Sep 11, 2019, 5:50 PM

      @Mark-Yorkovich said:

      …finding all of the new line/line feed characters - only in those now-bookmarked lines - and replace them with some other character (spaces, dummy chars, whatever) to get each of those records to be on one line

      Didn’t we do all this the other day?

      1 Reply Last reply Reply Quote 0
      • A
        Allen Bai
        last edited by Sep 12, 2019, 11:19 PM

        (.|){9}.

        how about this?

        E A 3 Replies Last reply Sep 13, 2019, 10:43 AM Reply Quote 0
        • E
          Ekopalypse @Allen Bai
          last edited by Sep 13, 2019, 10:43 AM

          @Allen-Bai

          I assume you meant (.\|){9}.
          This matches 9 and more pipe delimited lines.

          A 1 Reply Last reply Sep 13, 2019, 2:21 PM Reply Quote 1
          • A
            Allen Bai @Allen Bai
            last edited by Sep 13, 2019, 2:19 PM

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • A
              Allen Bai @Ekopalypse
              last edited by Allen Bai Sep 13, 2019, 2:22 PM Sep 13, 2019, 2:21 PM

              @Ekopalypse said:

              @Allen-Bai

              I assume you meant (.\|){9}.
              This matches 9 and more pipe delimited lines.

              in fact, I mean…

              (。\|){9}。*

              but it can’t show correctly, and I don’t know how to put screenshot

              1 Reply Last reply Reply Quote 0
              • P
                PeterJones
                last edited by PeterJones Sep 13, 2019, 2:28 PM Sep 13, 2019, 2:27 PM

                @Allen-Bai said:

                it can’t show correctly,

                To quote my boilerplate:

                This forum is formatted using Markdown, with a help link buried on the little grey ? in the COMPOSE window/pane when writing your post. For more about how to use Markdown in this forum, please see @Scott-Sumner’s post in the “how to markdown code on this forum” topic, and my updates near the end. It is very important that you use these formatting tips – using single backtick marks around small snippets, and using code-quoting for pasting multiple lines from your example data files – because otherwise, the forum will change normal quotes ("") to curly “smart” quotes (“”), will change hyphens to dashes, will sometimes hide asterisks (or if your text is c:\folder\*.txt, it will show up as c:\folder*.txt, missing the backslash).

                For images: upload image to imgur. embed images with the syntax ![](http://i.imgur.com/QTHZysa.png). (please use imgur’s “direct link” with i.imgur.com as the hostname and the appropriate .png or .gif extension, rather than the “image” link, which really links to the HTML-wrapper, and will not embed in the forum)

                1 Reply Last reply Reply Quote 2
                • A
                  Allen Bai @Allen Bai
                  last edited by Sep 13, 2019, 3:51 PM

                  @Allen-Bai said:

                  (.|){9}.

                  how about this?

                  in fact, I mean
                  (。*\|){9}。*

                  1 Reply Last reply Reply Quote 0
                  • P
                    PeterJones
                    last edited by PeterJones Sep 13, 2019, 6:53 PM Sep 13, 2019, 6:53 PM

                    @Allen-Bai said:

                    in fact, I mean
                    (。*\|){9}。*

                    Then why not put it in tick marks? Both the help I linked to and the “how to use markdown code” post explained how to do that, as did my boilerplate text itself.

                    • `(.*\|){9}.*`

                    renders as

                    • (.*\|){9}.*
                    1 Reply Last reply Reply Quote 1
                    • A
                      Allen Bai
                      last edited by Sep 13, 2019, 7:13 PM

                      ah…

                      understand now, thank you so much

                      1 Reply Last reply Reply Quote 0
                      • G
                        guy038
                        last edited by Oct 19, 2019, 1:10 PM

                        Hi, @mark-yorkovich, and All,

                        See my very late regex solution , below :

                        https://community.notepad-plus-plus.org/post/47905

                        Best Regards,

                        guy038

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