Is it possible to find regular expressions given matching examples?
examples = [
"my name is Alice",
"my name is Alex",
"my good name is Bruce"
]
I need to find a possible regular expression programmatically which matches all the above examples. For the given example set above, python regex would be my (.*)name is (.*)
or my (\w)name is (\w)
.
EDIT: I need to write a script which automates the extraction of regex for me.