Would the following be helpful?
use strict; use warnings; my $ha1 = "hostname62a"; my $ha2 = "hostname62b"; while (<DATA>) { print if /\s(?:$ha1|$ha2)\./; } __DATA__ 192.168.1.199 hostname62a.domain.com hostname62a 192.168.1.200 hostname62b.domain.com hostname62b 192.168.1.201 hostname62.domain.com hostname62 192.168.2.144 hostname62a-r.domain.com hostname62a-r 192.168.2.145 hostname62b-r.domain.com hostname62b-r
Output:
192.168.1.199 hostname62a.domain.com hostname62a 192.168.1.200 hostname62b.domain.com hostname62b
In reply to Re: Perl regex and word boundaries
by Kenosis
in thread Perl regex and word boundaries
by MeatLips
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |