Community
    • Login

    How to remove middle text?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    22 Posts 7 Posters 4.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.
    • guy038G
      guy038
      last edited by guy038

      Hello, @mary-soifaite,

      Thanks for your different images. And, this confirms that, if we consider the general template :

      STRING_1:STRING_2:STRING_3

      You’re expecting two lists :

      • One with STRING_1:STRING_2, so, the first two fields

      • One with STRING_2:STRING_3, so, the last two fields


      Thus,

      • The former list should be obtained with this regex S/R :

        • SEARCH ^([^:\r\n]+):((?1)):((?1))

        • REPLACE $1:$2

      • The later list should be obtained with this regex S/R :

        • SEARCH ^([^:\r\n]+):((?1)):((?1)) ( idem as above)

        • REPLACE $2:$3

      Of course, you must select the Regular expression search mode, tick the Wrap around option and, finally click on the Replace All button !


      Note that, instead of posting some images via an other site, you could have simply pasted the clipboard contents of your text, directly in your post area, by using the usual Ctrl + V shortcut : it’s easier for people to test regexes against your data

      Even better : before pasting your text, click on the </> button, first, in order to insert code text !

      Best regards,

      guy038

      1 Reply Last reply Reply Quote 1
      • Thomas 2020T
        Thomas 2020
        last edited by

        it can also be so

        ^([^:\n]+)(:)((?1))
        \1

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