in reply to Data format - delete parts of string and replace strings that match characters partly with numbers.
One possibility, for a file like that, is to split the data into columns, then work with the columns, then join them back into a record. Now you can deal with the individual pieces using regular expressions that are less intimidating (and fragile).
Your code should be bristling with data-integrity checks. Explicitly check that the array, after splitting, always contains exactly five elements, and, if there are any other “assertions” that you can make about what “a not-munged record in this file should look like,” you should add code in your program to explicitly check those, too. If it stumbles into any “none of the above ... this should not be happening ...” cases, it should die or (Carp) croak. In this way, if the program runs to completion as expected, it means something useful: it means not only that the program did what it was supposed to do, but that the incoming file is actually good, and/or that all of your assumptions about what it actually contains were (so far...) correct assumptions.