Community
    • Login

    How to make new lines without deleting

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    17 Posts 3 Posters 3.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.
    • MarkomarinM
      Markomarin
      last edited by Markomarin

      This post is deleted!
      1 Reply Last reply Reply Quote 0
      • Scott SumnerS
        Scott Sumner @Markomarin
        last edited by

        @Markomarin

        …only allowed to edit posts for 180 second(s) after posting

        Yes, this happens for everyone…just add a new post, don’t worry about the old one. The 180 seconds is for each individual post, not posts even older than that just because you happened to add a recent new post.

        1 Reply Last reply Reply Quote 1
        • MarkomarinM
          Markomarin
          last edited by

          The text is like
          “xyzxyz
          1. xyzxyz
          xyzxyz
          2. xyzxyz
          xyzxyz
          3. xyzxyz”
          The desired is like
          "xyzxyz

          1. xyzxyz
          xyzxyz
          
          2. xyzxyz
          xyzxyz
          
          3. xyzxyz"
          
          1 Reply Last reply Reply Quote 0
          • Scott SumnerS
            Scott Sumner @Markomarin
            last edited by

            @Markomarin

            Tip: You can edit the text you want to post here in Notepad++, then copy and paste it here. If you used the Markdown Viewer plugin, you should see a close representation to what it will look like when posted.

            Tip: Make sure that what shows up in the preview window is really what you want before clicking on Submit.

            1 Reply Last reply Reply Quote 2
            • MarkomarinM
              Markomarin
              last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • MarkomarinM
                Markomarin
                last edited by Markomarin

                Dear Scott Sumner,
                Everything is correct in the preview window, I put 4 spaces before every line including spaces but whenever I post it seems faulty.

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

                  @Markomarin,

                  Regex Issue

                  As mentioned in another thread, we linked you to the regex documentation FAQ three months ago, with the expectation that you wanted to learn, and would thus make use of those resources, rather than just continuing to have us do your job / hobby for you.

                  In a help forum like this (especially one that’s about an application, not a general regular expression help forum), requests for help are always taken better when you show a willingness to learn, and when you show an effort in your question. When you come every few months, and ask us to do all your regex work for you, we can lose interest in helping you.

                  (For all we know, you are being paid for the results of what you’re asking us to do. We are just volunteering. If we think you’re learning, we’ll probably keep helping. If we think you are trying to get free consulting work, you’ll find it harder to get answers.)

                  So, for example, after correctly quoting your text: show us regular expression you’ve tried, and explain why what you chose the regex you did (ie, what you think that regular expression is doing), and tell us what is wrong with the results.

                  Formatting issues:

                  When you say “everything is correct in the preview window”, we are asking you to look in the window on the right. When you indent text by four characters, in the preview window, it will show up in an obvious black box. Does it for you? If not, then not everything is correct in the preview window. Something that Scott might not have made clear: you need a blank line before and after the indented text.

                  For example, if I have this exact text:

                  \======
                  some normal text
                  
                      Four spaces, then your text, will offset it, and will prevent special `characters` and **blanks** from being deleted
                  
                  more normal text.
                  \======
                  

                  should look like this in your preview window, and thus in the final posting:

                  ======
                  some normal text

                  Four spaces, then your text, will offset it, and will prevent special `characters` and **blanks** from being deleted
                  

                  more normal text.
                  ======

                  For other formatting hints, you may want to study this post for more details.

                  1 Reply Last reply Reply Quote 4
                  • MarkomarinM
                    Markomarin
                    last edited by

                    Dear Peter Jones and Scott Sumner,
                    Of course I really appreciate your work and help you have given to over the months. Let me state the obvious I am not an expert on these issues. I have been using notepad++ for some months. And if I have offended or prevented from your concentration please accept my apologies.
                    I am using (regular exp.)

                    ^\d+\.\s 
                    \n 
                    

                    For the text like

                    xyzxyz
                    11. xyzxyz
                    xyzxyz
                    22. xyzxyz
                    xyzxyz
                    

                    it becomes

                    xyzxyz
                    
                    xyzxyz
                    xyzxyz
                    
                    xyzxyz
                    xyzxyz
                    

                    However what I want is

                    xyzxyz
                    
                    11. xyzxyz
                    xyzxyz
                    
                    12. xyzxyz
                    xyzxyz
                    

                    I think I could express my intentions. I greatly appreciated your past help and wouldn’t mind being neglected as you don’t have to prepare regex for ordinary computer users. Regards

                    Scott SumnerS 1 Reply Last reply Reply Quote 3
                    • Scott SumnerS
                      Scott Sumner @Markomarin
                      last edited by Scott Sumner

                      @Markomarin

                      So to me, the proper formatting really Really REALLY helps in clarifying the problem. It doesn’t make those willing to help have to think really hard about “just what IS the problem here” or “what IS the real data”, but rather they can think about solutions, which is the thing desired by all but especially the OP!

                      And showing what you’ve already tried is great too because it gives something to build upon! So I think we can start with what you have and tweak it slightly. Let’s use something called capturing groups. With them, you can use part of the Find expression in the Replace expression. You capture with parentheses, ( and ).

                      So in your case, if we capture like this in the Find expression: ^(\d+\.\s), whatever text matches what is between the parentheses goes into what is called Capture Group #1.

                      If we change your Replacement expression, like so: \n\1, wherever we see a \1, the contents captured in the find expression get inserted into the replacement text.

                      That all being said…are the better ways to write your find-and-replace expressions for this example? I would say that there are, but at this point it probably isn’t constructive to throw out what you arrived at, but simply better to just alter it slightly.

                      MarkomarinM 1 Reply Last reply Reply Quote 2
                      • MarkomarinM
                        Markomarin @Scott Sumner
                        last edited by

                        @Scott-Sumner
                        That was just the thing I was looking for, that was another thing I learned from this great community, Thanks guys.

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