• Login
Community
  • Login

How to delete the last 14 characters from a string

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
3 Posts 2 Posters 339 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.
  • R
    Red Sox Century
    last edited by Feb 26, 2022, 6:22 PM

    Dear Community -

    First let me say thank you for reading and any assistance would be most appreciated. I’m not a very tech saavy person and I’m getting older by the day (and I’m already a senior citizen).

    I am trying to replace every character after the semi-colon (;) in every string(?) of text in a list of parts. I have tried using Find and Replace and I have also searched for an answer but I just can’t grasp concept. Per the instructions on FAQ Desk - here is what I am trying to do:

    Delete all characters after the semi-colon in each row
    DRUM-00000001;DRUM-00000001
    DRUM-00000003;DRUM-00000003
    DRUM-00000004;DRUM-00000004
    DRUM-00000005;DRUM-00000005
    DRUM-00000008;DRUM-00000008
    DRUM-00000011;DRUM-00000011
    DRUM-00000014;DRUM-00000014

    Desired outcome would look like this:
    DRUM-00000001;
    DRUM-00000003;
    DRUM-00000004;
    DRUM-00000005;
    DRUM-00000008;
    DRUM-00000011;
    DRUM-00000014;

    Again, thank you very for reading.

    A 1 Reply Last reply Feb 26, 2022, 6:37 PM Reply Quote 0
    • A
      Alan Kilborn @Red Sox Century
      last edited by Feb 26, 2022, 6:37 PM

      You asked to do TWO different things:

      How to delete the last 14 characters from a string

      Find: (?-s).{14}$
      Replace: nothing
      Search mode: Regular expression

      Delete all characters after the semi-colon in each row:

      Find: (?-s);.*
      Replace: ;
      Search mode: Regular expression

      R 1 Reply Last reply Feb 26, 2022, 7:01 PM Reply Quote 3
      • R
        Red Sox Century @Alan Kilborn
        last edited by Feb 26, 2022, 7:01 PM

        @alan-kilborn said in How to delete the last 14 characters from a string:

        (?-s).{14}$

        Dear Mr. Kilborn -

        My word. Thank you so much for not only pointing out that I was asking about two different things but also for solving my issue. I’m so grateful. I’m going to try and work this out in my head so I understand this even though at my age its hard to concentrate on things like this. But I can still try.

        I hope you have a great day and find joy in helping this old guy work something out that IS way out of his (my) league.

        –Red

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