Search code examples
stringxml-parsingnotepad++

Notepad++ how to replace with random positions of text


I wanna replace few strings in my XML, but i didn't know, how to "TAG?" strings. I lost my passwords from Opera, but i got old copy from Mozilla but they was at different groups and parses so i wanna change they and import to Opera. I didnt know posibilites of Notepad, only i know how working \n \t \r and i find on internet only [^"]* that i know how working

Passwords from Mozilla in XML:

<entry host="http://auth.opera.com" user="myrandommail@gmail.com" password="RandomPassword123" formSubmitURL="https://auth.opera.com/account/authenticate/,

replace to:

Passwords from Opera in CSV (name,url,username,password,note,):

auth.opera.com,https://auth.opera.com/account/authenticate/,myrandommail@gmail.com,RandomPassword123,

Final effect what i trying to do from:

<entry host="http://[1^"]*" user="[2^"]*" password="[3^"]*" formSubmitURL="[4^"]*,

replace to

[1^"]*,[4^"],[2^"]*,[3^"]*,

I posted [1^"]* like a TAG of parse and selected classes to pharse [^"]*


Solution

  • Capture groups are written with parenthesis and are used in the replacement part with $n where n is the number of the group.

    For your example, you should use:

    • Find what: <entry host="http://([^"]*)" user="([^"]*)" password="([^"]*)" formSubmitURL="([^"]*),
    • Replace with: $1,$4,$2,$3