Community
    • Login

    How to remove quotes on lines with notepad?

    Scheduled Pinned Locked Moved General Discussion
    7 Posts 3 Posters 5.0k 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.
    • jamie rolJ
      jamie rol
      last edited by jamie rol

      Hello
      I need your help

      “ABIGAIL”:“17”
      “OLIVER”:“phone@”
      EVELYN:“news”
      ELIJAH:“Jackson”
      “AMELIA”:“23.5”
      “MASON”:“street”

      change to this:

      “ABIGAIL”:17
      “OLIVER”:phone@
      EVELYN:news
      ELIJAH:Jackson
      “AMELIA”:23.5
      “MASON”:street

      How could I do it?
      Thank you

      1 Reply Last reply Reply Quote 0
      • Jim DaileyJ
        Jim Dailey
        last edited by

        Use search and replace in regular expression mode:

         Search: ^([^:]+):"([^"]+)"
        Replace: \1:\2
        

        The parts of the search regular expression are:

        1)  ^         Look for the beginning of a line.
        2)  ([^:]+)   Capture the set of all characters that are NOT a :
        3)  :"        Find :"
        4)  ([^"]+)   Capture the set of all characters that are NOT a "
        5)  "         Find "
        

        The replace expression replaces what the search matched with the first set of captured text \1, a colon :, and the second set of captured text \2.

        1 Reply Last reply Reply Quote 3
        • jamie rolJ
          jamie rol
          last edited by

          @Jim-Dailey said:

          Search: ^([^:]+):“([^”]+)"
          Replace: \1:\2

          friend thanks, but I’ve tried it but it does not work, 0 occurrences were replaced

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

            Your data showed “smart quotes” (curly quotes), but @Jim-Dailey’s regex assumed regular quote marks " – probably because many normal quotes get changed into smart quotes when being posted to this forum, and he probably assumed yours were really normal quotes.

            Is you actual data with smart quotes or normal quotes?

            1 Reply Last reply Reply Quote 0
            • jamie rolJ
              jamie rol
              last edited by

              @jamie-rol said:

              ^([^:]+):“([^”]+)"

              Good afternoon, Mr. PeterJones, I have a data of 50000 lines and I need to delete the quotes after “:”, it must be smart quotes
              thanks for the interest

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

                @jaimie-rol, Good Morning (timezones are funny)

                So, @Jim-Dailey did an excellent job of explaining his regex. Based on his ^([^:]+):"([^"]+)", here are the steps I would take:

                1. I want the first quote in the regex to match an opening smart quote, instead of a normal quote. So let me try changing that character: ^([^:]+):“([^"]+)"
                2. I want the final quote in the regex to match an closing smart quote, instead of a normal quote. So let me try changing that character: ^([^:]+):“([^"]+)”
                3. Jim said that the middle section indicated “all characters that are not a [normal quote]”. Since I now want to find all characters that are not a closing smart-quote, let me try changing that character: ^([^:]+):“([^”]+)”
                4. I think that makes sense. Let’s try running it.

                When I try that final regex on the exact data you posted, I get what I believe you want out.

                Let us know whether this works for you or not. If not, study this post for hints on how to format the data so it comes across without being edited, so we know exactly the data you have.

                FYI: if you have further regex needs, study this FAQ and the documentation it points to. Before asking a new regex question, understand that many of us will expect you to show what data you have (exactly), what data you want (exactly), what regex you already tried (to show that you’re showing effort), why you thought that regex would work (to prove it wasn’t just something randomly typed), and what data you’re getting with an explanation of why that result is wrong. When you show that effort, you’ll see us bend over backword to get things working for you.

                1 Reply Last reply Reply Quote 2
                • jamie rolJ
                  jamie rol
                  last edited by

                  Thank you Mr. PeterJones

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