Here is a snippet of the page:
<tr id="product_34980" class="even">
<tr id="variant_100329" class="variantRow">
I want to extract the 34980 and the 100329. There could be multiple products and variants. I will be using python.
Thanks
Here is a snippet of the page:
<tr id="product_34980" class="even">
<tr id="variant_100329" class="variantRow">
I want to extract the 34980 and the 100329. There could be multiple products and variants. I will be using python.
Thanks
The link @Kirill Polishchuk gives is a favorite on SO, it states clearly why you should not use regex for this.
If however you still persist on using a regex, then try:
<tr[^>]*id="([^"]*)"[^>]*>
Your match is now in capture group #1
>>> p = re.compile('\d+')
>>> m = re.search(p, '<tr id="product_34980" class="even">')
>>> m.group()
'34980'