in reply to Re^2: Net::Telnet::Cisco and prompt regex issue
in thread Net::Telnet::Cisco and prompt regex issue
You're missing the '\' escape of the '.'
The dot isn't special inside of a character class, so no escaping required:
$ perl -E 'say "matched" if "foo-bar.baz" =~ /^[\w.-]+\z/' matched $ perl -E 'say "matched" if "foo-bar:baz" =~ /^[\w.-]+\z/'
The second case (with ':' in place of '.') doesn't match, because the (unescaped) dot in the pattern stands for a literal dot, not "any character" as it would outside of character classes.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Net::Telnet::Cisco and prompt regex issue
by josh803316 (Beadle) on Dec 09, 2010 at 21:10 UTC |