Say I have a string like so
txt = 'Source_Test_MyStuff_v001.0746.exr'
name = re.sub(r'\.([0-9]+)\.', '#', txt )
Outputs:
Source_Test_MyStuff_full_v001#exr
My goal is to find the group containing only numbers between the two periods .. and replace each number within the periods (.) with pound signs.
The desired result is this... Outputs:
Source_Test_MyStuff_full_v001.####.exr
Other examples that could occur:
Source_Test_MyStuff_v001.0586006.exr >> Source_Test_MyStuff_v001.#######.exr
Source_Test_MyStuff_v001.76.exr >> Source_Test_MyStuff_v001.##.exr
How can i achieve this with python and regex?