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.2k 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.
    • Reena DR
      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
        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
          Reena D
          last edited by

          Wow…
          Worked Perfectly…

          Thank you Verymuch…

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