Question about regular expression

gal kauffman gal.kauffman at gmail.com
Thu Oct 1 09:04:15 EDT 2015


My example will give false positive if there is a space before a comma. Or
anything else by the conventions in the original string.
I tried to keep it as simple as I could.
If you want to catch a wider range of values you can use *simple* regular
expression to catch as much spaces as you want.
On Oct 1, 2015 3:48 PM, "Tim Chase" <python.list at tim.thechases.com> wrote:
> On 2015年10月01日 01:48, gal kauffman wrote:
> > items = s.replace(' (', '(').replace(', ',',').split()
>> s = "name1 (1)"
>> Your suggestion doesn't catch cases where more than one space can
> occur before the paren.
>> -tkc
>>>> --
> https://mail.python.org/mailman/listinfo/python-list
>-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20151001/8c24a629/attachment.html>


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /