1

I try to replace "_v(anydigit)" to "_index" :

example :

file_v01.jpg to file_index.jpg using re.sub("_v\d\d","_index",file)

or

file_v0001.jpg to file_index.jpg using re.sub("_v\d\d\d\d","_index",file)

Those scripts works fine. But what if i don't know the digits . The number of digits is random , so it maybe _v1 or _v001 or _v023445. It should find all the digits behind the '_v' until it reach a non digit.

How can i catch it ?

andio
  • 1,574
  • 9
  • 26
  • 45
  • 1
    `\d+` matches 1+ digits. Study [Lesson 7: Mr. Kleene, Mr. Kleene](https://regexone.com/lesson/kleene_operators) to get familiarized with the basic quantifier(s). – Wiktor Stribiżew Jun 21 '19 at 14:02

0 Answers0