[Philadelphia-pm] selective splitting?
Nate Smith
nate at perlhack.com
Thu Nov 17 19:27:49 PST 2016
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
More information about the Philadelphia-pm
mailing list