jakarta-regexp-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [DO NOT REPLY: Bug 2525] Leading zero-length string splitted by RE
Date Tue, 28 Aug 2001 22:34:01 GMT
PLEASE DO NOT REPLY TO THIS MESSAGE. TO FURTHER COMMENT
ON THE STATUS OF THIS BUG PLEASE FOLLOW THE LINK BELOW
AND USE THE ON-LINE APPLICATION. REPLYING TO THIS MESSAGE
DOES NOT UPDATE THE DATABASE, AND SO YOUR COMMENT WILL
BE LOST SOMEWHERE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2525

*** shadow/2525	Mon Jul  9 18:50:38 2001
--- shadow/2525.tmp.16057	Tue Aug 28 15:34:01 2001
***************
*** 16,19 ****
  |                              DESCRIPTION                                   |
  When I use an RE, say "a*b", to split a string like "aaabxyz", I'd think only 1 
  part comes out, but there are 2 parts, with the first is a zero-length string. 
! I wonder there is something missed in RE.split.
--- 16,38 ----
  |                              DESCRIPTION                                   |
  When I use an RE, say "a*b", to split a string like "aaabxyz", I'd think only 1 
  part comes out, but there are 2 parts, with the first is a zero-length string. 
! I wonder there is something missed in RE.split.
! 
! ------- Additional Comments From graham@keystroke.com  2001-08-28 15:34 -------
! This seems to be consistent behavior with the split() method in general,
! specifically when a pattern match returns true on the very first character of a
! String instance.
! 
! Since split() returns an array of Strings if this particular condition exists
! (the first character of a String happens to be matched by the pattern in the RE
! instance when split() is called) the first element in the string array will be
! returned as an empty String.
! 
! This results in either negating any matching characters from the front of the
! String instance they are about to split(), or negate the empty String element
! from the returned array once split() has been called.  If matching characters
! are encountered at the end of the String instance they either seem to be
! ignored, or removed from the array before the array is returned.  Shouldn't this
! either be consistent, or should split() contain options for splitting on
! concurrent matches to yield empty String elements (so that this condition can be
! managed)? 

Mime
View raw message