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:
import re
import json
import requests
def stock_lookup(name):
url = "http://autoc.finance.yahoo.com/autoc?query={0}&callback=YAHOO.Finance.SymbolSuggest.ssCallback".format(name)
response = requets.get(url)
json_data = json.loads(re.match(data,"YAHOO.Finance.SymbolSuggest.ssCallback\((.*?)\)"))
return json_data
I get this error:
sre_constants.error: bad character range
Thanks in advance