I'm trying to isolate the number in a filename that can look like these:
DJI_0991.MP4
DJI_0992 - testing.MP4
The pattern is that it always starts with DJI_ and ends with either a period or a space.
Nevermind, solved! I don't know why this was giving me so much trouble. On the offchance anyone else comes this way:
DJI_0991.MP4
DJI_0992 - testing.MP4
The pattern is that it always starts with DJI_ and ends with either a period or a space.
Nevermind, solved! I don't know why this was giving me so much trouble. On the offchance anyone else comes this way:
import re filename = "DJI_0991.MP4" file_number = re.findall('DJI_(.+?)\W', filename) print (file_number )