I have strings like this:
(jack-9) - london
(neil-11) - india
I would like to write a rule that gives the number, how can I do that?
expected output:
9
11
>Solution :
You can use \w+\-(\d+):
>>> import re
>>> s = """(jack-9) - london
... (neil-11) - india"""
>>> re.findall("\w+\-(\d+)", s, re.MULTILINE)
['9', '11']