I have a list of numbers that have in the left the new number and in the right the old number I want to change, each separated by a Tab character: 000 256 007 002 056 078 And I have filenames with the following composition: aaaa_bbb_01_cccc_000_a aaaa_bbb_01_cccc_000_b aaaa_bbb_01_cccc_000_c aaaa_bbb_01_cccc_007_a aaaa_bbb_01_cccc_056_a I want to change the 3 digits that are together into it's corresponding new number, but the fact that some of the numbers in the filenames repeat have me a little stuck since I'm just trying to learn regex. The output I want would look like this (keeping the same order as above): aaaa_bbb_01_cccc_256_a aaaa_bbb_01_cccc_256_b aaaa_bbb_01_cccc_256_c aaaa_bbb_01_cccc_002_a aaaa_bbb_01_cccc_078_a How can I change these filenames using regex? If it's not possible using regex what other alternative could I use? by Claudia Provoste in StackOverflow on July 05, 2022 . Answer Extra...