I want to find several tags
in a webpage using regular expression, they have the same pattern: data-tag-slug="NAME"
, like this(only a small section):
...category="rating" data-tag-id="40482" data-tag-name="safe" data-tag-slug="safe"><a cla...
...category="" data-tag-id="42350" data-tag-name="solo" data-tag-slug="solo"><a cla...
And I coded tagName = r'.*data-tag-slug="(\w+)".*'
, use re.findall(tagName, html)
, yet I can only get one result, which is the very last item that fits the pattern. I wonder how can I get all of them.
P.S. By "the very last item", I mean that there're several tags that fit the pattern, but the code can only get the last one by the order of appearance in the html.