def threaded(query):
        # Different tags for different items
    ticker = query.lower()
    priceTag = "<span id=\"yfs_l84_"+str(ticker)+"\">(.+?)</span>"
   # percentTag = "<span id=\"yfs_p20_"+str(ticker)+"\">(.+?)</span>"
    #timeTag = "<span id=\"yfs_t53_"+str(ticker)+"\">(.+?)</span>"
   # titleTag = "<h2>(.+?)</h2>"
    
    
    text  = urllib2.urlopen("http://finance.yahoo.com/q?s="+str(ticker)).read()
    price = getReqRegexFromText(text,priceTag)
    #title = getReqRegexFromText(text,titleTag)
    result =  str(query) + " : " + str(price)
    print str(result)
def threaded(query):
        # Different tags for different items
    ticker = query.lower()
    priceTag = "<span id=\"yfs_l84_"+str(ticker)+"\">(.+?)</span>"
   # percentTag = "<span id=\"yfs_p20_"+str(ticker)+"\">(.+?)</span>"
    #timeTag = "<span id=\"yfs_t53_"+str(ticker)+"\">(.+?)</span>"
   # titleTag = "<h2>(.+?)</h2>"
    
    try:
        text  = urllib2.urlopen("http://finance.yahoo.com/q?s="+str(ticker)).read()
        price = getReqRegexFromText(text,priceTag)
        mainDict[query]=price
    except Exception:
        #print("Exception URL")
        mainDict[query]="Unavaliable"
        return 0 
    #The diffrent regex used for extraction
        ## str ticker is not actually needed for easness replace it with [^.]* ie. any character repeted multiple times
        priceTag = "<span id=\"yfs_l84_"+str(ticker)+"\">(.+?)</span>"
        percentTag = "<span id=\"yfs_p20_"+str(ticker)+"\">(.+?)</span>"
        timeTag = "<span id=\"yfs_t53_"+str(ticker)+"\">(.+?)</span>"
        titleTag = "<h2>(.+?)</h2>"
    else:
        priceTag = "<span id=\"yfs_l84_"+str(ticker)+"\">(.+?)</span>"
        percentTag = "<span id=\"yfs_p43_"+str(ticker)+"\">(.+?)</span>"
        timeTag = "<span id=\"yfs_t53_"+str(ticker)+"\">(.+?)</span>"
        timeTagInner = "<span id=\"yfs_t53_"+str(ticker)+"\">(.+?)EDT" # using EDT as a border , will add on EDT later
        titleTag = "<h2>(.+?)</h2>"
        marketCapTag = "<span id=\"yfs_j10_[^.]*\">(.+?)</span>"

    # getting the values 
    title = getReqRegexFromText(text,titleTag)[1]   # an array is returned , using the second value of that array 
    price = getReqRegexFromText(text,priceTag)
    ## There is an inner span id , get outer , then extract inner 
    #print str(getReqRegexFromText(text,timeTag)[0])
    time =  getReqRegexFromText(str(getReqRegexFromText(text,timeTag)),timeTagInner)
    
    percent = getReqRegexFromText(text,percentTag)
    marketCap = getReqRegexFromText(text,marketCapTag)
    try:
        price = price[0]
    except Exception:
        price = " Unavaliable"
    try:
        percent = percent[0]
    except Exception:
        percent = " Unavaliable"