python finding multiple occurrences between 2 delimiter
Question: i'm trying to find multiply occurrences between 2 delimiters using regex.
Unfortunately i can't figure out how. The 2 delimiters are ' and ':

    
    
    import re
    string = "'lightOff' 'lightOn':,'lightOff' 'ovenOff' 'ovenOn': None 'radioOn': 'radioOff'"
    print string
    print 'newString', re.findall("^'(.*?)':", string)
    

I only get the first match

    
    
    'lightOn'
    

What i want is to get the 3 substrings between ' and ':

    
    
    'lightOn'
    'ovenOn'
    'radioOn'
    


Answer: Do not use the anchor. `^` and `$` are the anchors in a regex pattern. Also,
when you match between two `'`, it'll return the string `'word1' 'word2':` as
output, instead of only `'word2':`. Try to match everything between two `'`
which isn't the character `'` itself.

    
    
    re.findall("'([^']+)':", string)
    

will work.

