On 2/1/07, oryann9 <[EMAIL PROTECTED]> wrote:
oryann9 <[EMAIL PROTECTED]> wrote: Hello Perl list,
[snip]
I was able to figure it out. The solution was /s. my $regexp = qr/.*\x3a5101.*/s; However, when I put multiple port numbers in the regexp it does NOT work. I want to store them in memory for later use which is why I am using 1,2,3,4... my $regexp = qr/(.*\x3a5101.*)(.*\x3a5051.*)(.*\x3a3191.*)(.*\x3a1026.*)/s;
Take another look at perlre and perlretut. That says, roughly: Match zero or more of any character followed by \x3a5101 followed by zero or more of any character followed by zero or more of any character followed by \x3a5051 followed by zero or more of any character followed by zero or more of any character followed by \x3a5101 followed by zero or more of any character followed by zero or more of any character followed by \x3a3191 followed by zero or more of any character followed by zero or more of any character followed by \x3a1026 followed by zero or more of any character. And save the various bits to numbered variables. You haven't included an "or" method anywhere; in order for a string to match your pattern, it has to contain all four complete elements. Also, why '\x3a' instead of ':'? and finally, if you're looking anywhere in the string, you don't need '.*' on both sides of the expression. You're probably looking for something like /:5101|:5051|:3191|:1026/ # or to capture the port number: /:(5101|5051|3191|1026)/ perlre has the details on '|'. HTH, -- jay -------------------------------------------------- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org values of β will give rise to dom!