in reply to search string regex
bart: Benchmarked for the same million iterations, your solution takes 35 seconds. EDIT: Benchmarking methodology is shown below:$_ = 'This is "the search" string "that was" supplied'; my @quotes = (m/"(.*?)"/g); s/".*?"//g; my @keys = split();
Only the mechanical portions of each algorithm were tested. The results can be easily duplicated with cut and paste.use strict; use warnings; my $time = time(); for (1..1000000) { $_ = 'This is "the search" string "that was" supplied'; my @quotes = (m/"(.*?)"/g); s/".*?"//g; my @keys = split(); } print time() - $time;
|
|---|