Re.findall() & Re.finditer()

  • + 2 comments

    match = re.findall(r'(?<=['+consonants+'])(['+vowels+']{2,})(?=['+consonants+'])',raw_input(),flags = re.I)
    
    ' Can someone kindly explain to me the use/meaning of the '?<=' and '?=' in the above snippet (from the editorial) in detail. Also,in re does ['+xyz+'] always get replaced by the string in xyz or it happens only when we use the '?' thingys? What is meant by positive/negative lookahead/lookbehind? I did google and refer the python documentation but couldn't understand about the '?' thingys nor could I find any concise explanation of the lookahead/lookbehind stuff. HELP! :P