ultibuzz has asked for the wisdom of the Perl Monks concerning the following question:
Hello,
i have the following Situation: a String of Numbers is given, an Array for matching several Numbers is given, i need to cut the matching Number and then print both the mathing Number and the rest with a ; between.
it shoud match from the beginning and it shoud match the longes possibility
Example: this number is given 012345666666 , these matchings are given 012345 and 0123456 , then 0123456 shoud be returnt not 012345
the array itself is 5025 elements big and i'm searching for faster ways then to join the array and doing a regex on each element.
also i can't find a way that the regex deliver back the longest matching possibility, for this reason i sortet the array so that the longest numbers comes first
my $filterregex = join('|',@Numbers)
/^$filterregex/
i'am using the Regex vars matching and rest to get everything i need, but the regex is still not working correctly and it's not that fast.
Summary: regex needed that matches from the beginning and delivers just the longes matching value, a possible faster way woud be great
kd
ultibuzz
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Regex only the longes Value , and possible speedup Problem
by reneeb (Chaplain) on Nov 14, 2006 at 09:50 UTC | |
by ultibuzz (Monk) on Nov 14, 2006 at 10:19 UTC | |
Re: Regex only the longes Value , and possible speedup Problem
by GrandFather (Saint) on Nov 14, 2006 at 09:10 UTC | |
by ultibuzz (Monk) on Nov 14, 2006 at 09:50 UTC | |
Re: Regex only the longes Value , and possible speedup Problem
by BrowserUk (Patriarch) on Nov 14, 2006 at 10:06 UTC | |
Re: Regex only the longes Value , and possible speedup Problem
by Anonymous Monk on Nov 14, 2006 at 09:46 UTC |