m/HOSTNAME:\s*(\d{4}-)?$dev_ref->{hostname}\s+GRBR:\s*$dev_ref->{grbr}/i
However, in the new code this fails.For debugging purposes I tried the following:
And here is debug output from the new script (where $buffer is what is in between the ////// dividers):my $pattern = qr{HOSTNAME:\s*(?:\d{4}-)?$dev_ref->{hostname}\s+GRB +R:\s*$dev_ref->{grbr}}i; print "DEBUG: \$pattern='$pattern'\n" if $DEBUG; my $hostname = $buffer =~ m/$pattern/i ? 1 : 0 ;
B U F F E R:
///////////////////////////////////////////////////////////////////////////////
9600/ARQ
Some Company
---> Unauthorized use of this router is prohibited <---
*******************************************************
* Hostname: 2383-rwan-1 GRBR: 2383 *
* Model: Cisco 1234 *
* Location: Ansalon , DL *
*******************************************************
---> Unauthorized Access is strictly prohibited <---
User Access Verification
Username:
///////////////////////////////////////////////////////////////////////////////
DEBUG: $pattern='(?i-xsm:HOSTNAME:\s*(?:\d{4}-)?2383-RWAN-1\s+GRBR:\s*2383)'
From tests in the code I know that $hostname is being set to 0. Any ideas why the match always fails in the new code? Note that I tried the exact same RegEx and test from the old script and it still fails. I also tried e.g. matching against '9600' and 'Username' and those also failed. Help!! :-/
UPDATED: Argh!!! I copied old code over to the new app but missed renaming one of the variables. SIGH.... Thanks for the comments and sorry I wasted your time.
-- Argel
In reply to RegEx Confusion by Argel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |