Here's the case :
str='myfile.#.#####-########.ext'
i want to replace the # with number : 456 so it should be :
str = 'myfile.456.00456-00000456.ext'
the second case :
str= 'myfile.%012d.tga'
replace the pattern with number 456 so it will become :
str= 'myfile.000000000456.tga'
i can solve this using string replacement method by grab the pattern then count the digits then fill with zero pad. Right now , i want to know how to do it using regex in python ? Can anyone help ? Thanks a lot.
##,###?0456and00456respectively.