Nate Smith on 17 Nov 2016 19:28:22 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [Philadelphia-pm] selective splitting?


On Thu, Nov 17, 2016 at 09:11:50PM -0500, James E Keenan wrote:
> I often find that trying to write the One Regex to Rule Them All is
> a time-consuming experience that leads to unreadable code.
> Sometimes partially processing a string with one regex and then
> completing the processing with a second is more readable, even if
> not, in principle, as fast.
> 
> How far does this get you?
> 
> my ($date, $ignore, $ip, $agent) = split /;/, $v, 4;

I love this!  It happens to work here b/c the field with the unwanted
semicolons is the last one, but you definitely win on brevity!

-Nate
_______________________________________________
Philadelphia-pm mailing list
Philadelphia-pm@pm.org
http://mail.pm.org/mailman/listinfo/philadelphia-pm