Skip to content

Instantly share code, notes, and snippets.

@jaganadhg
Created February 12, 2020 04:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaganadhg/e2956b3d4b3f61ca7dad12f70a95438a to your computer and use it in GitHub Desktop.
Save jaganadhg/e2956b3d4b3f61ca7dad12f70a95438a to your computer and use it in GitHub Desktop.
import re
from collections import Counter
data = ["/mnt/volume1/vol/img.img","/mnt/volume1/some.img","/mnt/volume2/simg.img"]
def match_volume(input_data,search_patten):
regex_patt = re.compile(search_patten)
macthed_gen = [regex_patt.search(inp) for inp in input_data]
match_count = Counter(mtch.group() for mtch in macthed_gen if mtch)
return match_count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment