Community
    • Login

    How to find and replace nth character from last in notepad++

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    search & replacesearch & replacereplace
    3 Posts 2 Posters 3.6k Views 1 Watching
    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.
    • Reena DR Offline
      Reena D
      last edited by Reena D

      Below is Original

      AI 2015
      Adu 2020
      Ajji 2017
      Akam 2011
      Alai 2003

      I want ot Replace the Space before the Year with TAB like Below,

      AI 2015
      Adu 2020
      Ajji 2017
      Akam 2011
      Alai 2003

      So i want to replace the 5th Charrecter from last… Any Help ?

      1 Reply Last reply Reply Quote 0
      • David ShakedD Offline
        David Shaked
        last edited by

        Try a regular expression (regex) replacement. For example:

        1. On the menu, click Search > Replace.

        2. Select the Regular Expression option.

        3. In the Find What box, enter:
          \s([0-9]{4}\R)
          This expression finds a space character, followed by a sub-expression containing four instances of a digit 0-9 and a newline.

        4. In the Replace With box, enter:
          \t($1)
          This expression replaces the found string with a tab character, followed by the Find What sub-expression.

        5. Click the Replace All button.

        Vary the regex syntax according to the precise requirements of your file. For a detailed explanation of the syntax, see:
        https://npp-user-manual.org/docs/searching/
        https://www.boost.org/doc/libs/1_70_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html

        1 Reply Last reply Reply Quote 4
        • Reena DR Offline
          Reena D
          last edited by

          Wow…
          Worked Perfectly…

          Thank you Verymuch…

          1 Reply Last reply Reply Quote 1

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors