fork download
  1. import re
  2.  
  3. pattern = r"\bCarnival: monitor service-([a-z]{2}) Beta\b"
  4. r = "Carnival: monitor service-eu Beta cloudwatch_module"
  5. m = re.search(pattern, r)
  6. if m:
  7. test_string1 = m.group(1)
  8. test_string = test_string1.upper()
  9.  
  10. print(test_string)
  11. print(test_string1)
Success #stdin #stdout 0.05s 9676KB
stdin
Standard input is empty
stdout
EU
eu