The problem is that you're using match()
to search for a substring in a string.
The method match()
only works for the whole string. If you want to search for a substring inside a string, you should use search()
.
As stated by khelwood in the comments, you should take a look at: Search vs Match.
Code:
import re
res = re.search(r"\d+", 'editUserProfile!input.jspa?userId=2089')
print(res.group(0))
Output:
2089
Alternatively you can use .split()
to isolate the user id.
Code:
s = 'editUserProfile!input.jspa?userId=2089'
print(s.split('=')[1])
Output:
2089