I am trying to break a line similar to Python using re.split:
#NAME="Foo" NAME2="foobar" NAME3="BAR BAR" comp = "NAME=\"Foo\" NAME2=\"FOO BAR\" NAME3=\"BAR BAR\""
This is what my split function looks like, including regex:
re.split('(\s\w+\=\".*?\")', comp)
The result is as follows:
['NAME="Foo"', 'NAME2="foobar"', '', 'NAME3="BAR BAR"', '']
As long as this is correct, I would like to get rid of all empty elements.
Hedge
source share