• Login
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.
  • Q
    Qwfsdf Qdfwefx
    last edited by Qwfsdf Qdfwefx Apr 23, 2023, 6:42 PM Apr 23, 2023, 6:31 PM

    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.

    M 1 Reply Last reply Apr 23, 2023, 6:42 PM Reply Quote 1
    • M
      Mark Olson @Qwfsdf Qdfwefx
      last edited by Mark Olson Apr 23, 2023, 6:44 PM Apr 23, 2023, 6:42 PM

      @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.

      Q 2 Replies Last reply Apr 23, 2023, 7:13 PM Reply Quote 5
      • Q
        Qwfsdf Qdfwefx @Mark Olson
        last edited by Apr 23, 2023, 7:13 PM

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

        A 1 Reply Last reply Apr 23, 2023, 7:18 PM Reply Quote 0
        • A
          Alan Kilborn @Qwfsdf Qdfwefx
          last edited by Apr 23, 2023, 7:18 PM

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

          1 Reply Last reply Reply Quote 3
          • Q
            Qwfsdf Qdfwefx @Mark Olson
            last edited by Qwfsdf Qdfwefx May 2, 2023, 7:47 PM May 2, 2023, 7:41 PM

            @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)

            P 1 Reply Last reply May 2, 2023, 7:50 PM Reply Quote 0
            • P
              PeterJones @Qwfsdf Qdfwefx
              last edited by May 2, 2023, 7:50 PM

              @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