Wagner, David --- Senior Programmer Analyst --- WGO wrote:
I took a quick look at some of the earlier emails and Charles Clarkson's email is what you are after. Using the push on your hash to create the array.

You're quite right, it does. I was testing it and was getting the same result as with my code so I assumed it couldn't do what I was after. I've since realised it's my regular expression that's wrong :o(


My Regex:

([A-Z1-9]{8})

pattern_match script:

#!/usr/bin/perl

while (<>) {
  chomp;
  if (/regex/) {
    print "Matched:  |$`<$&>$'|\n";


This test will match (<>) the expression then surround the rest of the line with ||.


% ./pattern_match data
Matched: |22 06:15:20 splinter postfix/smtp[42690]: 291E2130: to=<[EMAIL PROTECTED]>, relay=splinter.example.com[192.168.0.1], delay=5, status=sent (250 Ok: queued as <3B6DB28A>533)|


As you can see, it's matching part of the larger string rather than the exact 8 charachter string.

I was expecting it to match "291E2130".

I've tried various incarnations of my regex but I just can't get it to match.

([A-Z1-9]{8,8}) - Still matches part of the larger string.

([A-Z1-9]{8,8}): - Won't match.

([A-Z1-9]{8,8})\: - Won't match.

Can anyone advise what I should be doing with the regex?

Thanks, Nick





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to