This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dnotmanj
Recipients dnotmanj, ezio.melotti, mrabarnett
Date 2015-01-25.17:31:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1422207097.55.0.514125060003.issue23318@psf.upfronthosting.co.za>
In-reply-to
Content
# Python 3.3.1 (default, Sep 25 2013, 19:30:50)
# Linux 3.8.0-35-generic #50-Ubuntu SMP Tue Dec 3 01:25:33 UTC 2013 i686 i686 i686 GNU/Linux

import re

splitter = re.compile( r'(\s*[+/&;,]\s*)|(\s+and\s+)' )
ll = splitter.split( 'Dave & Sam, Jane and Zoe' )
print(repr(ll))

print( 'Try again with revised RegEx' )
splitter = re.compile( r'(?:(?:\s*[+/&;,]\s*)|(?:\s+and\s+))' )
ll = splitter.split( 'Dave & Sam, Jane and Zoe' )
print(repr(ll))

Results:
['Dave', ' & ', None, 'Sam', ', ', None, 'Jane', None, ' and ', 'Zoe']
Try again with revised RegEx
['Dave', 'Sam', 'Jane', 'Zoe']
History
Date User Action Args
2015-01-25 17:31:37dnotmanjsetrecipients: + dnotmanj, ezio.melotti, mrabarnett
2015-01-25 17:31:37dnotmanjsetmessageid: <1422207097.55.0.514125060003.issue23318@psf.upfronthosting.co.za>
2015-01-25 17:31:37dnotmanjlinkissue23318 messages
2015-01-25 17:31:37dnotmanjcreate