I have IP's in an IIS6 XML format metabase that I want to search for the regular expression 10.198.68.??3 and replace it with that same thing only changing the very last 3 to a 2. Thus the following should replace:
10.198.68.153 --> 10.198.68.152
10.198.68.73 --> 10.198.68.72
10.198.68.3 --> 10.198.68.2
InsertMode
ColumnModeOff
HexOff
UnixReOn
Top
Find RegExp "(10[.]198[.]68[.])3(\D)"
Replace All "\12\2"
Top
Find RegExp "(10[.]198[.]68[.])([0-9]*)3(\D)"
Replace All "\1\22\3"
Top
Find RegExp "(10[.]198[.]68[.])([0-9]*)([0-9]*)3"
Replace All "\1\2\32"
I'm not sure that last find is correct, I think it could do the wrong thing on some inputs, e.g. 10.198.68.33, 10.198.68.333, 10.198.68.343 or 10.198.68.533
I think it should be:
Find RegExp "(10[.]198[.]68[.])([0-9]+)([0-9]+)3"
(+ instead of * so they can't match zero characters)
but I'm having difficulty testing it because the macro is crashing UE on some inputs. e.g. a file containing these lines:
That's something - I've never had a macro doing nothing more than search/replace result in crashing UE before.
I tried to test your suggestion about substituting a + for the *, and used one of your strings 10.198.68.533 to replace the first line in my original test file.
I tried jpax's simpler find replace but i got 'search string not found' error. To be more specific I'm attempting to parse a Win2003 IIS6 metabase.xml file and replace all th IPs last number from 2 --> 3 in an effort to add a third server to our web farm. The IP 10.198.68.XX3 is followed by :80: & :443: for http & https so the find replace will be working on a lines that looks exactly like this: