Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm new to regexes and have a file that looks like this one:

|60|493,93|1,6500|
|60|95,72|1,6500|
|60|43,88|1,6500|
|60|972,46|1,6500|

I used the regex (\|60|.*)(1,65) and I was able to find all the lines that have the information that I wanted to changed.

How can I make an replace that when Notepad++ finds (\|60|.*)(1,65), the 60 should be replaced with 50:

|50|493,93|1,6500|
|50|95,72|1,6500|
|50|43,88|1,6500|
|50|972,46|1,6500|

PS: here's an example of the full line:

|C170|002|34067||44,14000|KG|493,93|0|0|020|1102||288,11|12,00|34,57|0|0|0|0|||0|0|0|60|493,93|1,6500|||8,15|60|493,93|7,6000|||37,54||
share|improve this question
add comment

migrated from stackoverflow.com Sep 18 '12 at 8:40

This question came from our site for professional and enthusiast programmers.

1 Answer

I think this is what you want:

Find what: ^(.*)\|60\|(.*1,65.*)

Replace with: \1|50|\2

share|improve this answer
    
The part that I paste is only the result of the (\|60|.*)(1,65), the full line is in the end of the post (I edited it) –  Ricardo Sa Sep 17 '12 at 18:39
1  
Just remove the ^ from the front of the regex and it should work properly. –  F.J Sep 17 '12 at 18:40
    
Updated my answer. It's ugly. –  Sean Bright Sep 17 '12 at 18:41
    
That worked exactly as I needed... just another question if I needed to changed the |1,65| how was that going to be? –  Ricardo Sa Sep 17 '12 at 18:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.