New to python regex and would like to write something that matches this
<name>.name.<age>.age@<place>
I can do this but would like the pattern to have and check name and age.
pat = re.compile("""
^(?P<name>.*)
\.
(?P<name>.*)
\.
(?P<age>.*)
\.
(?P<age>.*?)
\@
(?P<place>.*?)
$""", re.X)
I then match and extract the values.
res = pat.match('alan.name.65.age@jamaica')
Would like to know the best practice to do this?
(?P<name>.*)group?matchis my requirement. Its a pattern with name and age being always present, hence would like to check it. @Tomalak'.name'is always present, I see.