Using python shell:
namesRegex=re.compile(r'Agent (\w)\w*')
namesRegex.findall('Agent Alice gave the secret documents to Agent Bob.')
output:['A', 'B']
the regular expression confused, me aren't we supposed to get [Agent A ,Agent B] ?
namesRegex.sub(r'Agent \1*****','Agent Alice gave the secret documents to Agent Bob.')
output:'Agent A***** gave the secret documents to Agent B*****'
could someone explain to me the last output and how it's relation works and valid with last Regular expression ?