From: Ilya Zakharevich Date: Tue, 5 Jan 1999 00:56:01 +0000 (-0500) Subject: Change #2584 from maint-5.005: X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f3a6e3356179a29b3e34d4dbbd1c3cc37167e95d;p=p5sagit%2Fp5-mst-13.2.git Change #2584 from maint-5.005: implemented Ilya's suggested fix, and added a testcase Message-Id: <199901050556.AAA02597@monk.mps.ohio-state.edu> Subject: Re: Text::ParseWords: regex fix p4raw-id: //depot/cfgperl@2585 --- diff --git a/lib/Text/ParseWords.pm b/lib/Text/ParseWords.pm index 2414f80..065c2f7 100644 --- a/lib/Text/ParseWords.pm +++ b/lib/Text/ParseWords.pm @@ -63,7 +63,7 @@ sub parse_line { ([\000-\377]*) # and the rest | # --OR-- ^((?:\\.|[^\\"'])*?) # an $unquoted text - (\Z(?!\n)|$delimiter|(?!^)(?=["'])) + (\Z(?!\n)|(?-x:$delimiter)|(?!^)(?=["'])) # plus EOL, delimiter, or quote ([\000-\377]*) # the rest /x; # extended layout diff --git a/t/lib/parsewords.t b/t/lib/parsewords.t index 9079179..3c5e75b 100755 --- a/t/lib/parsewords.t +++ b/t/lib/parsewords.t @@ -7,7 +7,7 @@ BEGIN { use Text::ParseWords; -print "1..17\n"; +print "1..18\n"; @words = shellwords(qq(foo "bar quiz" zoo)); print "not " if $words[0] ne 'foo'; @@ -101,3 +101,8 @@ $string = 'aaaa"bbbbb" cc\ cc \\\\\"dddd\' eee\\\\\"\\\'ffff\' gg'; $result = join('|', parse_line('\s+', 0, $string)); print "not " unless $result eq 'aaaabbbbb|cc cc|\"dddd eee\\\\"\'ffff|gg'; print "ok 17\n"; + +# test whitespace in the delimiters +@words = quotewords(' ', 1, '4 3 2 1 0'); +print "not " unless join(";", @words) eq qq(4;3;2;1;0); +print "ok 18\n";