Skip to content

Instantly share code, notes, and snippets.

@simonreeves
Created December 16, 2020 17:33
Show Gist options
  • Save simonreeves/842829405c47db653736b5f8ad519e03 to your computer and use it in GitHub Desktop.
Save simonreeves/842829405c47db653736b5f8ad519e03 to your computer and use it in GitHub Desktop.
regex find version #python #version
# Find 3 digit string version with prefix 'v' - but dont incliude the v in the result
# v### - with postive lookbehind for the v
filename = '/mydir_v012/myfile_v012.1001.exr'
# wil' return list of all found results
find_versions = re.findall('(?<=v)\d{3}', filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment