parsing question

Sarah Burcham sarah at pound.perl.org
Thu Mar 22 14:19:37 CST 2001


> 	($fieldname, $data) = split /: */;  

That matches 0 or more spaces.  So when it hits the first colon,
the regex is satisfied.

Maybe you want:

($fieldname, $data) = split /:\s+/;

-sarah

On Thu, Mar 22, 2001 at 11:57:16AM -0800, mikeraz at patch.com wrote:
> I'm parsing a web form generated data set that looks like:
> 
> name:   data
> fname:  data
> time3:30-6:00:	data
> morestuff:
> gunk-o-rama:	data
> 
> The colons are followed by spaces or end of line, never tabs.
> 
> I thought that 
> 	($fieldname, $data) = split /: */;  
> would do the trick, but that ended up splitting the time entry at the first
> colon.
> 
> Huh?  '3' ne ' ' so what am I misunderstanding here?
> 
> And no, I did NOT design the web form that generates this.
> 
> 
> -- 
>     Michael Rasmussen   mikeraz at patch.com
>    Be appropriate && Follow your curiosity
>      But keep in mind:
> A couple more shots of whiskey, women 'round here start looking good.
> 
> 		[something about a 10 being a 4 after a six-pack?  Ed.]
> TIMTOWTDI
TIMTOWTDI



More information about the Pdx-pm-list mailing list