I am trying to use the python regular expression to check if a string contains some given substring and also ends with a certain expension
for example, given some_processed_file.mp4.gz
, I want to check if processed
is in the string and it ends with mp4.gz
But even doing something like:
x = 'some_processed_file.mp4.gz'
re.search(r'/processed/', x)
Even this returns None. I must confess I do not really understand regular expressions but I thought this should look for substring anywhere in the input string.
re.search('processed.*\.mp4\.gz', x)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.