<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial, helvetica, sans-serif;font-size:10pt"><DIV>No, as the matching deleimters are captured. I can use the numbers as seperator.</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Courier New, courier, monaco, monospace, sans-serif">perl -MData::Dumper -MRegexp::Common -le '<BR>&nbsp;&nbsp;&nbsp; $a="15678.91 ml; .121 0.12312&nbsp; 12313. r45.12 ";<BR>&nbsp;&nbsp;&nbsp; @a= grep {! /^$/} split /($RE{num}{real})/, $a;<BR>&nbsp;&nbsp;&nbsp; print Dumper&nbsp; \@a'<BR>$VAR1 = [<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '15678.91',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' ml; ',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '.121',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' ',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '0.12312',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '&nbsp; ',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '12313.',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' r',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 '45.12',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' '<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ];<BR></FONT><BR></DIV>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 10pt"><BR>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt"><FONT size=2 face=Tahoma>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> tiger peng &lt;tigerpeng2001@yahoo.com&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Chicago.pm chatter &lt;chicago-talk@pm.org&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Thu, October 22, 2009 2:37:16 PM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [Chicago-talk] split function and zero-width seperator<BR></FONT><BR>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 10pt">
<DIV>I found the answer by checking&nbsp;perldoc of split, it says:</DIV>
<DIV>&nbsp;</DIV>
<DIV>If the PATTERN contains parentheses, additional list elements are created from each matching substring in the delimiter.&nbsp;</DIV>
<DIV><BR>It seems I have to simplify the seperater (PATTERN) first.</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Courier New, courier, monaco, monospace, sans-serif">perl -MData::Dumper -le '$s=chr(127);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $a = "15678.91 ml; r45.12 ";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $a =~ s/((?!(\d|\.))(?&lt;=(\d|\.)))|((?=(\d|\.))(?&lt;!(\d|\.)))/$s/g;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @a = split /$s/, $a;</FONT></DIV>
<DIV><FONT face="Courier New, courier, monaco, monospace, sans-serif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print Dumper(@a)'<BR>$VAR1 = '';<BR>$VAR2 = '15678.91';<BR>$VAR3 = ' ml; r';<BR>$VAR4 = '45.12';<BR>$VAR5 = ' ';</FONT><BR></DIV>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 10pt">
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt"><FONT size=2 face=Tahoma>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> tiger peng &lt;tigerpeng2001@yahoo.com&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> <A href="http://chicago.pm/" target=_blank>Chicago.pm</A> chatter &lt;chicago-talk@pm.org&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Thu, October 22, 2009 2:11:29 PM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> [Chicago-talk] split function and zero-width seperator<BR></FONT><BR>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 10pt">
<DIV><FONT face="arial, helvetica, sans-serif">Hello everyone,</FONT></DIV>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 10pt">
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt">
<DIV style="FONT-FAMILY: Courier New, courier, monaco, monospace, sans-serif; FONT-SIZE: 10pt">
<DIV><FONT face="arial, helvetica, sans-serif"></FONT>&nbsp;</DIV>
<DIV><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"><FONT face="arial, helvetica, sans-serif">I am trying to&nbsp;isolate numbers from string, manipulate the numbers then put them back to original positions in the string. When I try to use zero-width separator, the split function looks weird, it generated&nbsp;much more elements than I expect.</FONT></SPAN></DIV>
<DIV><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"><FONT face="arial, helvetica, sans-serif"></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"><FONT face="arial, helvetica, sans-serif">Are&nbsp;there any mistakes? Why the split behaviors like this? (The regexp&nbsp;looks right when I use it with s///)</FONT></SPAN></DIV>
<DIV><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"><FONT face=Arial></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"><FONT face=Arial>Could anyone help?</FONT></SPAN></DIV>
<DIV><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"><FONT face=Arial></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"><FONT face=Arial>Thanks,</FONT></SPAN></DIV>
<DIV><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"><FONT face=Arial>Tiger</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV>#build the seperator</DIV>
<DIV>:-) perl -le '$a = "15678.91 ml; r45.12 ";</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $a =~ s/((?!(\d|\.))(?&lt;=(\d|\.)))|((?=(\d|\.))(?&lt;!(\d|\.)))/|/g;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print $a'<BR>|15678.91| ml; r|45.12|</DIV>
<DIV>&nbsp;</DIV>
<DIV>#use the seperator in split</DIV>
<DIV>:-) perl -MData::Dumper -le '$a = "15678.91 ml; r45.12 ";</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @a = split /((?!(\d|\.))(?&lt;=(\d|\.)))|((?=(\d|\.))(?&lt;!(\d|\.)))/, $a;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print Dumper(@a)'<BR>$VAR1 = '15678.91';<BR>$VAR2 = '';<BR>$VAR3 = undef;<BR>$VAR4 = '1';<BR>$VAR5 = undef;<BR>$VAR6 = undef;<BR>$VAR7 = undef;<BR>$VAR8 = ' ml; r';<BR>$VAR9 = undef;<BR>$VAR10 = undef;<BR>$VAR11 = undef;<BR>$VAR12 = '';<BR>$VAR13 = '4';<BR>$VAR14 = undef;<BR>$VAR15 = '45.12';<BR>$VAR16 = '';<BR>$VAR17 = undef;<BR>$VAR18 = '2';<BR>$VAR19 = undef;<BR>$VAR20 = undef;<BR>$VAR21 = undef;<BR>$VAR22 = ' ';<BR></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV><!-- cg1.c902.mail.ac4.yahoo.com compressed/chunked Thu Oct 22 19:40:06 PDT 2009 --></div></body></html>