Re: Quote-aware string splitting



> import re
> regex = re.compile(r'''
> '.*?' | # single quoted substring
> ".*?" | # double quoted substring
> \S+ # all the rest
> ''', re.VERBOSE)

Oh, and if your strings may span more than one line, replace re.VERBOSE
with re.VERBOSE | re.DOTALL.

George

.



Relevant Pages