re.split() problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Masayuki Takemura

    #1

    re.split() problem

    Hi all.

    re.split() doesn't work as I intend.

    My Python Version is 2.4.1
    (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32.

    For example,
    [color=blue][color=green][color=darkred]
    >>> r = re.compile('^$' , re.MULTILINE)
    >>> r.split('foo\nb ar\n\nbaz')[/color][/color][/color]
    ['foo\nbar\n\nba z']

    but I expected ['foo\nbar\n', 'baz'].

    This problem has been discussed following threads.

    [ 852532 ] ^$ won't split on empty line
    <http://sourceforge.net/tracker/index.php?func= detail&aid=8525 32&group_id=547 0&atid=105470 >

    re.split on empty patterns
    <http://thread.gmane.or g/gmane.comp.pyth on.devel/62231>

    Will it be fixed in Python 2.4.2?

    Regards,

    --
    Masayuki Takemura

Working...