in reply to Re: Regex: Matching around a word(s)
in thread Regex: Matching around a word(s)

Nice++
Did a benchmark (I'll post later with some tweaks) and it seems that for a few terms, the match/span is about twice as fast then the double regex, with more terms it goes down to about 70% faster.

Simply splitting without actually doing any processing
my ($text,@words) = @_; my @text = split /\s+/, $text; my @results; for my $t (@text){ for my $w (@words){ push @results if $t eq $w; } }
is about 46% slower then the pattern match/span solution.


-Lee

perl digital dash (in progress)