Suppose I have a string \"a foobar\" and I use \"^a\\s*\" to match \"a \".
Is there a way to easily get \"foobar\" returned? (What was NOT matched)
I want to
Instead of splitting or separating, maybe you can use re.sub and substitute a blank, empty string ("") whenever you find the pattern. For example...
>>> import re
>>> re.sub("^a\s*", "","a foobar")
'foobar''
>>> re.sub("a\s*", "","a foobar a foobar")
'foobr foobr'
>>> re.sub("87\s*", "","87 foo 87 bar")
'foo bar'