Domi
Domi

Reputation: 217

combine two lines into one with special condition in notepad++

i need to conevert line like this

[
"country": "AD",
"name": "Sant Julià de Lòria",
"country": "BE",
"name": "Pas de la Casa",
"country": "IT",
"name": "Ordino",
"country": "AD",
"name": "les Escaldes",
"country": "IE",
"name": "Callan",
"country": "AE",
"name": "Abu Dhabi",
...
]

into this:

"name": "Sant Julià de Lòria, AD",
"name": "Pas de la Casa, BE",
"name": "Ordino, IT",
"name": "les Escaldes, AD",

i tried this but no success. thank you for your time.

Upvotes: 1

Views: 71

Answers (1)

The fourth bird
The fourth bird

Reputation: 163342

The page you are referring to uses a single capturing group and you could use \R to match a unicode newline sequence.

Find what

"country":\h+"([^"]+)",\R("name":\h+"[^"]+)(",)

Replace with:

$2, $1$3

Check Wrap around, enable Regular expression and click Replace All

Result

"name": "Sant Julià de Lòria, AD",
"name": "Pas de la Casa, BE",
"name": "Ordino, IT",
"name": "les Escaldes, AD",

Before

enter image description here

After

enter image description here

Upvotes: 2

Related Questions