Python: UserWarning: This pattern has match groups. To actually get the groups, use str.extract

The alternative way to get rid of the warning is change the regex so that it is a matching group and not a capturing group. That is the (?:) notation.

Thus, if the matching group is (url1|url2) it should be replaced by (?:url1|url2).

Leave a Comment