But at this point, I’m not sure I want to run the risk of you blaming us anymore for your problem. Hopefully this post will show you what happened.
When I started with
Begin PolyList Begin Polygon Origin -00128.000000,-00128.000000,-00128.000000 Normal -00001.000000,+00000.000000,+00000.000000 TextureU +00000.000000,+00001.000000,+00000.000000 TextureV +00000.000000,+00000.000000,-00001.000000 Vertex -00128.768546,-00128.000000,-00128.766453 Vertex -00128.000000,-00128.000000,+00128.000000 Vertex -00128.000000,+00131.756453,+00128.000000 Vertex -00128.000000,+00131.000000,-00128.000000 End Polygonwith your three pesky spaces (or without, because it doesn’t affect the regex at all), and run @ekopalypse’s regex once with REPLACE ALL, it fixes two of the three instances:
Begin PolyList Begin Polygon Origin -00128.000000,-00128.000000,-00128.000000 Normal -00001.000000,+00000.000000,+00000.000000 TextureU +00000.000000,+00001.000000,+00000.000000 TextureV +00000.000000,+00000.000000,-00001.000000 Vertex -00128.768546,-00128.000000,-00128.000000 Vertex -00128.000000,-00128.000000,+00128.000000 Vertex -00128.000000,+00131.000000,+00128.000000 Vertex -00128.000000,+00131.000000,-00128.000000 End PolygonThen I run it a second time, and it fixes the third instance.
Begin PolyList Begin Polygon Origin -00128.000000,-00128.000000,-00128.000000 Normal -00001.000000,+00000.000000,+00000.000000 TextureU +00000.000000,+00001.000000,+00000.000000 TextureV +00000.000000,+00000.000000,-00001.000000 Vertex -00128.000000,-00128.000000,-00128.000000 Vertex -00128.000000,-00128.000000,+00128.000000 Vertex -00128.000000,+00131.000000,+00128.000000 Vertex -00128.000000,+00131.000000,-00128.000000 End PolygonThe reasons this happens is because of the way the regex engine works inside of Notepad++: The first match found the start of the line, followed by Vertex, followed by as many characters as it could, until it hit the literal period that wasn’t before 6 zeroes. That means in -00128.768546,-00128.000000,-00128.766453 that it gobbled up all the characters until it found 766453 (the second set of non-zero decimal-fraction digits)… that’s then the fraction that it replaced with 000000 on that row. But at that point, the search cursor had moved beyond that line, so it didn’t see that the line still matches the regex. Hence it left that line as
Vertex -00128.768546,-00128.000000,-00128.000000When you run the regex a second time, it gets rid of the second match earlier in the line.
If @Ekopalypse had used a non-greedy regex ^Vertex.*?\.\K(?!0{6})(\d{6}) (the extra ? makes it non-greedy), then it would have fixed the 768546 on the first run of the regex, and 766453 on the second.
Either way, just run the regex more than once, and it will work for you. If there are three numbers possible on each line (and given “polygon” and “vertex”, I am assuming that those are 3d coordinates, so three seems a reasonable max-per-line), then you should only have to run the regex a maximum of 3 times to get all the replacements done.