Reputation: 929
First the text looked like this:
Ab Yz=15,Cd Wx=2,Ef Tu=20,...
I replaced all ,
with \r\n
, so the text looked like this:
Ab Yz=15
Cd Wx=2
Ef Tu=20
Than I wanted only the numbers after the =
and replaced ^.+[=]
with "blank" and my result was just 20
Does Notepad++ think, that the whole document only has a single line and takes the last =
and deletes everything before that?
How can I fix this? Oh and how can I remove the text after the =
? (including =)
Edit: I also tried ^.+[\=]
, ^.+(=)
and ^.+(\=)
but I got the same result.
Upvotes: 1
Views: 2735
Reputation: 48711
I guess you have unintentionally checked . matches newline option which makes a .
in a regex to go beyond a line - it will match newlines as well (AKA DOTALL modifier). So you should uncheck it.
Also there is no need to do this job in two separate steps. Use regex [^=]+=(\d+),?
and replace with \1\n
This will turn such an input string:
Ab Yz=15,Cd Wx=2,Ef Tu=20,Ef Tu=20,Ef Tu=20,Ef Tu=20,Ab Yz=15,Cd Wx=2,Ef Tu=20,Ef Tu=20,
To:
15
2
20
20
20
20
15
2
20
20
Upvotes: 2
Reputation: 91430
To change all in one pass, you could do:
(?:^|,)[^=]+=([^,]+)(?:,|$)
$1\r\n
Upvotes: 0