Sorting text
-
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.
-
@Qwfsdf-Qdfwefx
Find/replace form.
Find:(?-i)"Username": "([^"]+)",\R"Password": "([^"]+)",
Replace with\1:\2
Regular expressions on.Thank you very much for enclosing your text in a code box and including multiple examples. That made my life much easier.
-
@Mark-Olson thank you so much for fast reply, i just tested, works great! Helped me a lot
-
The title of this thread is misleading.
It has nothing to do with “sorting”. -
@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)
-
@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