I'm trying to create a general regex based on string1. The regex should match any string2 which has the same order of characters as string1, but string2 could have other characters in between characters of string1, I'm only concerned about the order.
string = 'abc'
regexString = reduce(lambda char1,char2 : '\w*' + char1 + '\w*' + char2, string)
print regexString
\w*\w*a\w*b\w*c
I was expecting the regexString to be:
'\w*a\w*b\w*c'
I don't understand why there is an extra '\w*' at the start of regexString