• Login
Community
  • Login

Find and replace 3rd occurrence of symbol (changing CSV)

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
3 Posts 2 Posters 337 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
    Robert Barba
    last edited by Nov 17, 2023, 2:32 AM

    Here the example
    D:America:US:CA:Springfield:92584
    How we’d like to turn out is
    D:America:US:CA - Springfield:92584

    This way the state and city are together

    I look forward to your guidance and suggestions

    T 1 Reply Last reply Nov 17, 2023, 2:53 AM Reply Quote 1
    • T
      Terry R @Robert Barba
      last edited by Terry R Nov 17, 2023, 2:55 AM Nov 17, 2023, 2:53 AM

      @Robert-Barba said in Find and replace 3rd occurrence of symbol (changing CSV):

      I look forward to your guidance and suggestions

      With only 1 example line it’s possible you haven’t presented enough versions of data for me to be entirely convinced this will work completely.

      However using the Replace function we have
      Find What^([a-z]+:){3}[a-z]+\K:
      Replace With:\x20-\x20 the \x20 is a space and can be entered by you as a space. I’ve just shown the code for it so you can see there is additional characters in the replacement field.
      The search mode needs to be regular expression.

      If this doesn’t work as expected you will need to supply more examples. Those additional examples need to be loaded inside of a code box. Please read this post titled Please Read This Before Posting which you would have seen when looking at the forum. They are there to help you and us to limit the number of back and forward questions that ultimately arise due to low (insufficient) examples and information.

      Good luck
      Terry

      PS by the way your title is wrong, from the example you show it is the 4th occurence you want changed, not the 3rd.

      1 Reply Last reply Reply Quote 3
      • R
        Robert Barba
        last edited by Nov 18, 2023, 8:46 PM

        thank you, and I didn’t realize it was the 4th… lol!
        here are 5 examples all of various lengths.

        D:America:US:CA:Springfield:92584
        D:America:US:OR:Salem:97301
        D:America:US:NH:Portsmouth:03801
        D:America:US:NJ:Little Egg Harbor:08087
        D:America:US:IL:Oak Brook:60523

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