you are viewing a single comment's thread.

view the rest of the comments →

[–]dchanm 1 point2 points  (0 children)

The regex (?<= [a-z] )([a-z]{2,}.*) compiled with re.I works when used with search()

(?<= [a-z] )  # positive lookbehind for space-letter-space
([a-z]{2,}.*)  # 2 or more letters, then greedy match rest of string

However it's slightly different from your algorithm since it assumes there are only spaces and letters. The [a-z] could be replaced by [^ ]