in reply to Double RegEx
If you know the order in which they'll appear in the string being matched,
if($element[4] =~ /\Q$Homosapiens\E.*\Q$choromosome\E/)will work fine. If you don't know the order, you want
if ($element[4] =~ /^ (?=.*?\Q$Homosapiens\E) (?=.*?\Q$choromosome\E) /x)
It reads: "Match homo sapiens somewhere after the start of the line, then match chromosome somewhere after the start of the line."
Update: I overlooked the obvious:
if ($element[4] =~ /\Q$Homosapiens\E/ && $element[4] =~ /\Q$choromosome\E/)
And since you're searching for constant strings, the following would be even faster:
if (index($element[4], $Homosapiens) >= 0 && index($element[4], $choromosome) >= 0)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Double RegEx
by MonkPaul (Friar) on Jun 27, 2005 at 14:44 UTC | |
|
Re: Double RegEx
by MonkPaul (Friar) on Jun 29, 2005 at 13:27 UTC | |
by ikegami (Patriarch) on Jun 29, 2005 at 14:42 UTC |