Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Perl regex and word boundaries

by Kenosis (Priest)
on Feb 13, 2013 at 19:59 UTC ( #1018619=note: print w/replies, xml ) Need Help??


in reply to Perl regex and word boundaries

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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1018619]
help
Chatterbox?
[LanX]: OK ... will you also come to YAPC::EU ?
[choroba]: Will Glasgow have been out of the EU by that time already?
[LanX]: nope
hippo might venture to YAPC::EU.
[choroba]: YAPC::YAEC (yet another European country)
[LanX]: they are proposing an infinite transition phase now ...
[choroba]: infinite transition implies infinite money!

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2018-02-23 10:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (301 votes). Check out past polls.

    Notices?