by Mofi » Thu Jul 27, 2006 6:11 am
One solution is to use a macro with several regular expression search and replaces. Enable the macro property Continue if a Find with Replace not found for this macro!
The first macro is with UltraEdit style regular expressions.
InsertMode
ColumnModeOff
HexOff
UnixReOff
Top
Find RegExp "^([0-9][0-9][0-9]^)^([0-9][0-9][0-9]^)^([0-9][0-9][0-9]^)"
Replace All "^1,^2,^3"
Find RegExp "^([0-9][0-9]^)^([0-9][0-9][0-9]^)^([0-9][0-9][0-9]^)"
Replace All "^1,^2,^3"
Find RegExp "^([0-9]^)^([0-9][0-9][0-9]^)^([0-9][0-9][0-9]^)"
Replace All "^1,^2,^3"
Find RegExp "^([0-9][0-9][0-9]^)^([0-9][0-9][0-9]^)"
Replace All "^1,^2"
Find RegExp "^([0-9][0-9]^)^([0-9][0-9][0-9]^)"
Replace All "^1,^2"
Find RegExp "^([0-9]^)^([0-9][0-9][0-9]^)"
Replace All "^1,^2"
The same macro with Unix or Perl regular expressions, if you prefer one of these regular expression engines.
InsertMode
ColumnModeOff
HexOff
UnixReOn
Top
Find RegExp "(\d\d\d)(\d\d\d)(\d\d\d)"
Replace All "\1,\2,\3"
Find RegExp "(\d\d)(\d\d\d)(\d\d\d)"
Replace All "\1,\2,\3"
Find RegExp "(\d)(\d\d\d)(\d\d\d)"
Replace All "\1,\2,\3"
Find RegExp "(\d\d\d)(\d\d\d)"
Replace All "\1,\2"
Find RegExp "(\d\d)(\d\d\d)"
Replace All "\1,\2"
Find RegExp "(\d)(\d\d\d)"
Replace All "\1,\2"
An explanation about Regular Expressions and the meanings of the sequences above can be found in help of UltraEdit. If you have numbers larger 999,999,999 you have to add additional find/replaces at top of the macro after the command Top. It should be clear how these replaces must be defined and in which sequence.