fork download
  1. import re
  2.  
  3. pattern = r':group_id=>"(sg-[^"\r\n]+)"'
  4. s = "describe aws_security_group({:group_id=>\"sg-ezsrzerzer\", :vpc_id=>\"vpc-zfds54zef4s\"}) do"
  5.  
  6. print(re.findall(pattern, s))
Success #stdin #stdout 0.02s 9328KB
stdin
Standard input is empty
stdout
['sg-ezsrzerzer']