Community
    • Login

    I need help to remove a string

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 245 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.
    • SerraCaboS
      SerraCabo
      last edited by

      Hi.

      I have a file containing expressions like:

      (tstamp 0079956c-31f8-44a4-92be-90a7cd4470f3)

      That I need to delete from ( to ).

      Say, I want to replace:
      (tstamp
      until
      )
      by
      “” (nothing)

      (tstamp is, of course the ‘thing’ to look after.

      Could I have some help, please?

      Thanks
      SC

      1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones
        last edited by

        FIND = \(.*?\)
        REPLACE = empty (nothing)
        SEARCH MODE = regular expression

        PeterJonesP 1 Reply Last reply Reply Quote 0
        • PeterJonesP
          PeterJones @PeterJones
          last edited by

          On re-reading, I saw a fine point I may have missed: if you only want to delete parenthesized items when it starts with (tstamp, then slight change:

          • FIND = \(tstamp.*?\)

          The rest remains the same.

          With this,

          (blah keep this) (tstamp blah blah) (blah keep this)
          

          will become

          (blah keep this)  (blah keep this)
          

          If you have more requirements (the paren must start at the beginning of the line and/or end at the end of the line, or other such modifications), those refined requirements can be met. However, you will need to be more explicit.

          ----

          Do you want regex search/replace help? Then please be patient and polite, show some effort, and be willing to learn; answer questions and requests for clarification that are made of you. All example text should be marked as plain text using the </> toolbar button or manual Markdown syntax. Screenshots can be pasted from the clipbpard to your post using Ctrl+V to show graphical items, but any text should be included as literal text in your post so we can easily copy/paste your data. Show the data you have and the text you want to get from that data; include examples of things that should match and be transformed, and things that don’t match and should be left alone; show edge cases and make sure you examples are as varied as your real data. Show the regex you already tried, and why you thought it should work; tell us what’s wrong with what you do get… Read the official NPP Searching / Regex docs and the forum’s Regular Expression FAQ. If you follow these guidelines, you’re much more likely to get helpful replies that solve your problem in the shortest number of tries.

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