I ran into a small problem using Python Regex.
Suppose this is the input:
(zyx)bc
What I'm trying to achieve is obtain whatever is between parentheses as a single match, and any char outside as an individual match. The desired result would be along the lines of:
['zyx','b','c']
The order of matches should be kept.
I've tried obtaining this with Python 3.3, but can't seem to figure out the correct Regex. So far I have:
matches = findall(r'\((.*?)\)|\w', '(zyx)bc')
print(matches)
yields the following:
['zyx','','']
Any ideas what I'm doing wrong?