In python, suppose I want to search the string
"123"
for occurrences of the pattern
"abc|1.*|def|.23" .
I would currently do this as follows:
import re
re.match ("abc|1.*|def|.23", "123") .
The above returns a match object from which I can retrieve the starting and ending indices of the match in the string, which in this case would be 0 and 3.
My question is: How can I retrieve the particular word(s) in the regular expression which matched with
"123" ?
In other words: I would like to get "1.*" and ".23". Is this possible?