fork(1) download
  1. import re
  2. theString = "ABCDE"
  3. pattern = re.compile(r"([^A-Z]*)([A-Z]{3})([^A-Z]*)")
  4. result = pattern.search(theString)
  5.  
  6. print("Matched string: " + result.group(0))
  7. print("Sub match 1: {" + result.group(1) + "} 2. {" + result.group(2) + "} 3. {" + result.group(3) + "}")
Success #stdin #stdout 0.1s 10096KB
stdin
Standard input is empty
stdout
Matched string: ABC
Sub match 1: {} 2. {ABC} 3. {}