There are multiple space separated characters in the input eg: string = "a b c d a s e "
What should the pattern be such that when I do re.search
on the input using the pattern, I'd get the j
'th character along with the space following it in the input by using .group(j)
?
I tried something of the sort "^(([a-zA-Z])\s)+"
but this is not working. What should I do?
EDIT My actual question is in the heading and the body described only a special case of it: Here's the general version of the question: if I have to take in all patterns of a specific type (initial question had the pattern "[a-zA-Z]\s") from a string, what should I do?