Community
    • Login

    Sorting text

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 4 Posters 537 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.
    • Qwfsdf QdfwefxQ
      Qwfsdf Qdfwefx
      last edited by Qwfsdf Qdfwefx

      Hello, im very new at notepad++, and im wondering if it is possible to sort the text from:

      "Username": "login",
      "Password": "password1",
      "Username": "login812",
      "Password": "password241",
      "Username": "login312",
      "Password": "password123",
      

      to:

      login:password1
      login812:password241
      login312:password123
      

      i will be much appreciated if some1 could tell me how i can do it.

      Mark OlsonM 1 Reply Last reply Reply Quote 1
      • Mark OlsonM
        Mark Olson @Qwfsdf Qdfwefx
        last edited by Mark Olson

        @Qwfsdf-Qdfwefx
        Find/replace form.
        Find: (?-i)"Username": "([^"]+)",\R"Password": "([^"]+)",
        Replace with \1:\2
        Regular expressions on.

        Relevant documentation

        Thank you very much for enclosing your text in a code box and including multiple examples. That made my life much easier.

        Qwfsdf QdfwefxQ 2 Replies Last reply Reply Quote 5
        • Qwfsdf QdfwefxQ
          Qwfsdf Qdfwefx @Mark Olson
          last edited by

          @Mark-Olson thank you so much for fast reply, i just tested, works great! Helped me a lot

          Alan KilbornA 1 Reply Last reply Reply Quote 0
          • Alan KilbornA
            Alan Kilborn @Qwfsdf Qdfwefx
            last edited by

            The title of this thread is misleading.
            It has nothing to do with “sorting”.

            1 Reply Last reply Reply Quote 3
            • Qwfsdf QdfwefxQ
              Qwfsdf Qdfwefx @Mark Olson
              last edited by Qwfsdf Qdfwefx

              @Mark-Olson hi, if u here, i need help again, basically almost the same problem, but now without “” (quotes) and , (comma), for example i have change this:

              UserName: qwerty
              Password: asdfgh
              UserName: qwerty1
              Password: zxcvbn
              UserName: qwerty2
              Password: tyuiop
              

              to this:

              qwerty:asdfgh
              qwerty1:zxcvbn
              qwerty2:tyuiop
              

              i really dont know what i need to change in ur code which u send above, to make result, will be grateful if u can help me(or someone else)

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

                @Qwfsdf-Qdfwefx said in Sorting text:

                i really dont know what i need to change in ur code

                Oddly enough, if you don’t have quotes and commas in your new text document, you would likely get rid of quotes and commas from @Mark-Olson’s example regex.

                ----

                Please note: This Community Forum is not a data transformation service; you should not expect to be able to always say “I have data like X and want it to look like Y” and have us do all the work for you. If you are new to the Forum, and new to regular expressions, we will often give help on the first one or two data-transformation questions, especially if they are well-asked and you show a willingness to learn; and we will point you to the documentation where you can learn how to do the data transformations for yourself in the future. But if you repeatedly ask us to do your work for you, you will find that the patience of usually-helpful Community members wears thin. The best way to learn regular expressions is by experimenting with them yourself, and getting a feel for how they work; having us spoon-feed you the answers without you putting in the effort doesn’t help you in the long term and is uninteresting and annoying for us.

                ----

                Useful References

                • Notepad++ Online User Manual: Searching/Regex
                • FAQ: Where to find other regular expressions (regex) documentation
                1 Reply Last reply Reply Quote 3
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors