Community
    • Login

    How i use replace commands

    Scheduled Pinned Locked Moved General Discussion
    2 Posts 2 Posters 928 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.
    • Rodrigo XiDoR
      Rodrigo XiDo
      last edited by

      i want use the replace command to put the number of line
      find x
      replace x<number of line>
      will be like this
      x1
      x2
      x3
      x4

      and where i find the instruction for more commands.

      1 Reply Last reply Reply Quote 0
      • dinkumoilD
        dinkumoil
        last edited by dinkumoil

        You could do that by

        1. using the block editor to insert line numbers at the beginning of all lines.
        2. using a regular expression to do your replacements.
        3. removing the line numbers added in step 1.

        At first place the cursor to the beginning of the document (line 1, column 1) then open the Column Editor. You can find it under Edit (menu) -> Column Editor... (default shortcut ALT+C).

        • Choose Text to Insert, enter a SPACE character in the input field and click OK.
        • Open the Column Editor again. Choose Number to Insert, set Initial Number to 1, set Increase by to 1, leave the Repeat field blank , choose under Format the item Dec and click OK.

        Now every line of your document should be preceded by its line number, separated by a SPACE character.

        Now open the Find & Replace dialog. Tick the Wrap around checkbox and under Search mode choose Regular expression. In the Find what field type ^([0-9]+) (.*?x)(.*) (Note: x is your search term ) and in the Replace with field type \1 \2\1\3. Then click Replace All.

        As the last step remove the line numbers by using the column editing mode. Set the cursor to the beginning of the document and press ALT+SHIFT+Down until you’ve reached the end of the document. Now you can delete the line numbers and the trailing SPACE characters by pressing the DELETE key.

        The regular expression I provided above may or may not fit your needs, you have to try. If it doesn’t work come back and provide specific informations about the problem.

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