• Login
Community
  • Login

Removing punctuation before a line

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
13 Posts 5 Posters 1.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.
  • У
    УменяМодем ОграниченныйТрафик
    last edited by May 24, 2020, 6:13 AM

    How do I delete this punctuation before a line (dots and commas) when editing text!?
    Can there be such an opportunity in the editor to do this!?word.png

    Как удалить вот эту пунктуацию перед строкой (точки и запятые) при редактировании текста!?
    Может есть такая возможность в редакторе это сделать!?

    A 1 Reply Last reply May 24, 2020, 11:12 AM Reply Quote 0
    • A
      Alan Kilborn @УменяМодем ОграниченныйТрафик
      last edited by Alan Kilborn May 24, 2020, 11:14 AM May 24, 2020, 11:12 AM

      @УменяМодем-ОграниченныйТрафик

      A search should find it: ^[.,]
      Set Search mode to Regular expression first.
      If you can find it you can remove it by replacing it with nothing.

      There are other ways as well; you could column-block-select the first column (Shift+Alt+arrows) and then when you have the correct selection, press the Delete key.

      1 Reply Last reply Reply Quote 1
      • У
        УменяМодем ОграниченныйТрафик
        last edited by May 24, 2020, 4:09 PM

        The second option is known to me, and is not suitable for a megabyte of text, and the first option I did not understand, I am a novice - I do not understand what you mean, what are you talking about here!?

        E A 2 Replies Last reply May 24, 2020, 6:42 PM Reply Quote 0
        • E
          Ekopalypse @УменяМодем ОграниченныйТрафик
          last edited by May 24, 2020, 6:42 PM

          @УменяМодем-ОграниченныйТрафик said in Removing punctuation before a line:

          first option I did not understand

          The first solution of @Alan-Kilborn refers to the find dialog.

          1 Reply Last reply Reply Quote 1
          • A
            Alan Kilborn @УменяМодем ОграниченныйТрафик
            last edited by May 24, 2020, 7:39 PM

            @УменяМодем-ОграниченныйТрафик said in Removing punctuation before a line:

            the first option I did not understand, I am a novice - I do not understand what you mean, what are you talking about here!?

            Really?
            You are using a text editor and you don’t know about searching or how to do it??

            1 Reply Last reply Reply Quote 0
            • G
              guy038
              last edited by May 24, 2020, 9:34 PM

              Hello, @уменямодем-ограниченныйтрафик , @alan-kilborn and All,

              So, I’m going to follow Rubber Duck method , too ;-))

              A) Regarding the first option :

              Assuming that all your lines begin with, either a comma or a dot, here is the method to delete these first characters with a search/replacement, already mentioned by @alan-kilborn :

              • Open the Replace dialog ( Ctrl + H )

              • Type in the regex ^[,.] in the Find what: zone

              • Leave the Replace with: zone EMPTY

              • Tick the Wrap around option

              • Select the Regular expression search mode

              • Left-click on the Replace All button

              => DONE !

              Notes :

              • The ^ is an assertion which looks for a beginning of line

              • The [,.] is a class-character structure, which searches, either for a comma or a dot symbol


              B) Regarding the second option :

              The usual way to perform a Column Mode selection is to use the Shift + Alt + Arrows shortcuts, as mentioned by @alan-kilborn

              However, in case of an huge selection, the easy solution is to use the Begin/End Select feature ! Here is the road map :

              • Hit the Ctrl + Home shortcut to move to the very beginning of the first line of your current file

              • Run the menu option Edit > Begin/End Select

              • Now, hit the Ctrl + End shortcut to move to the very end of your file

              • Press and hold down the ALT key and left click after the first comma or dot of the last line to select

              • Choose, again, the menu option Edit > Begin/End Select

              => After a while, needed to process all the lines of your current file, you should notice your one-column rectangular selection !

              • Finally, press the Delete key to suppress this first column

              => DONE !

              Note : If you forget to hold down the ALT key, when located at the last line, you, obviously, get a normal selection of all your text !

              Best Regards,

              guy038

              У 1 Reply Last reply May 25, 2020, 3:44 PM Reply Quote 1
              • У
                УменяМодем ОграниченныйТрафик
                last edited by May 25, 2020, 3:42 PM

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • У
                  УменяМодем ОграниченныйТрафик @guy038
                  last edited by May 25, 2020, 3:44 PM

                  I didn’t understand anything on the first point - all that after Ctrl + H

                  P 1 Reply Last reply May 25, 2020, 4:36 PM Reply Quote 0
                  • P
                    PeterJones @УменяМодем ОграниченныйТрафик
                    last edited by May 25, 2020, 4:36 PM

                    @УменяМодем-ОграниченныйТрафик said in Removing punctuation before a line:

                    I didn’t understand anything on the first point - all that after Ctrl + H

                    Given your username, I am guessing that English isn’t your native tongue, which is fine. But if you are having trouble understanding the answers, try passing them through a translator like deepl.com or translate.google.com

                    About the most confusing part of @guy038’s answer was that he indicated setting the Replace With field/box empty by using EMPTY, which strongly implies literal text, which wasn’t what he was intending.

                    For this time, I will supply a picture for you. I have marked up @guy038’s instructions with numbers in red, then put red notes on the dialog’s screenshot, so you can see how his instructions map to what actually appears. Fill out the Replace box so it looks like this:
                    f9f485ca-c337-4c4b-bbf3-7e4aa741081e-image.png
                    After it’s filled out, click the Replace All button, or whatever that button says in your preferred language.

                    1 Reply Last reply Reply Quote 2
                    • У
                      УменяМодем ОграниченныйТрафик
                      last edited by May 26, 2020, 9:48 PM

                      I’ve tried this, all dots and commas disappear from the entire text!
                      I need it to disappear before the line!
                      This can be done!? - To disappear the dots and commas before the line as in my picture!?
                      I don’t need to delete punctuation from the entire text!
                      Only where the arrows show!

                      P 1 Reply Last reply May 26, 2020, 11:32 PM Reply Quote 0
                      • P
                        PeterJones @УменяМодем ОграниченныйТрафик
                        last edited by May 26, 2020, 11:32 PM

                        @УменяМодем-ОграниченныйТрафик ,

                        If every dot and comma disappeared, you did not enter the Find what expression correctly. provide a screenshot.

                        In my example screenshot, there are only two matches, despite having four commas or periods. That’s because the search expression anchors to the start-of-line with the ^

                        f730b2ca-b736-4ee2-bc7c-647d73fe9989-image.png

                        If I replace all, then I get:
                        884d4913-ad1a-4704-9d0c-d91b45645118-image.png

                        Notice that it did not delete all commas and periods, but just the ones at the beginning of the line.

                        I am assuming you forgot to include the ^ at the beginning of the expression, or otherwise didn’t type things exactly as @guy038 described and I showed the screenshot. Please show a screenshot of your Replace dialog both before and after hitting Replace All to show exactly what you are trying.

                        1 Reply Last reply Reply Quote 1
                        • G
                          guy038
                          last edited by guy038 May 26, 2020, 11:46 PM May 26, 2020, 11:43 PM

                          Hi, @уменямодем-ограниченныйтрафик , @alan-kilborn, @peterjones and All,

                          In the Find what: box you must type in the regex ^[,.] ( NOT [,.] )

                          From this picture below, you should hold down the Shift key and hit the ^ 6 , key on top of your main keyboard to produce the ^ character, which is the regex char for beginning of line !

                          330e7d2b-944c-4567-aeca-3ffe8b0478be-image.png

                          Cheers,

                          guy038

                          1 Reply Last reply Reply Quote 1
                          • У
                            УменяМодем ОграниченныйТрафик
                            last edited by May 29, 2020, 4:12 AM

                            Yes, everything worked out, thank you!
                            The first time I didn’t understand anything… the second time I didn’t notice my mistake…
                            And the third time you read that I understood everything! :)

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