# http://stackoverflow.com/q/32942976/5290909
#python 2.7.10

import re

text = """
sample_string = 'asdfanksdfkjasdf_ash'
sample_str = "asdfasdfasdf_ash"
sample_st = assdfvb/23+sdf_ash
sample_s : 'assdfvb/23+sdf_ash'
sample = {'sample' : { 'hi' : 'asdfasdf+/asdf+_ash' , 'hello' : 'asdfasf+/asdf+v_ash' }}
"""
n = 0

pattern = re.compile( r'[=:]\s*(?:(["\'])((?:(?!\1).)*_ash)\1|(\S*_ash)(?!\S))')

#loop all matches
for match in pattern.finditer(text):
    n += 1
    print '\nMatch #%s:' % n
    
    #Show groups 2 and 3 captures
    for i in range(2,4):
        print 'Group %s - [%s:%s]:  %s' % (i, match.start(i), match.end(i), match.group(i))