My string is this:
<tr id="xyz21" style="" class="standard">
When I run my regex through the online regex helper site, pythex.org, I get what I'm wanting; only the number "21". The site says:
Match captures "21"
Here's the regex I used:
<tr id="xyz(.*?)"
However, when I use this same regex in my Python 3 script, I get much more. Here's the script with the result:
>>> import re
>>> x = '<tr id="xyz21" style="" class="standard">'
>>> num = re.search('<tr id="xyz(.*?)"', x).group()
>>> print(num)
<tr id="xyz21"
Ultimately, all I want is to create a variable with a value of "21". By the way, the actual string I use the regex on is a lot longer than what I'm showing. It's a small file, actually. I've simplified my example just to make it easier to understand. Any ideas?