Skip to content Skip to sidebar Skip to footer

Regex Sre_constants.error: Bad Character Range

I'm trying to a get a JSON string from another string with this regex: YAHOO.Finance.SymbolSuggest.ssCallback\((.*?)\) It works on regex101.com, but when I use it in my code: impo

Solution 1:

You misplaced the arguments in the match method, regex should come first.

re.match("YAHOO.Finance.SymbolSuggest.ssCallback\((.*?)\)", data)

re.match documentation:

re.match(pattern, string, flags=0)

The error is shown because most probably there is some z-A type of range in the data.

Post a Comment for "Regex Sre_constants.error: Bad Character Range"