Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Re: Match all emails from all subdomains for a domain except one.. (tye)

by shenme (Priest)
on Aug 09, 2003 at 07:36 UTC ( [id://282385]=note: print w/replies, xml ) Need Help??


in reply to Re: Match all emails from all subdomains for a domain except one.. (tye)
in thread Match all emails from all subdomains for a domain except one..

Whoops, that last RE fails against just "@example.com".

I think I've got it working with negative look-behind, but try to think of other test cases.

while( <DATA> ) { my( $expect, $string ) = split; my $result = $string =~ m/ @ (?: .* (?<! [@.] bar) \. )? example\.com $ /xi ? 'match' : 'fail'; printf " Got result '%s' when expecting '%s' on '%s'\n", $result, $expect, $string unless $result eq $expect; } __END__ match smith@example.com match jones@example.com match jones@foo.example.com fail jones@bar.example.com fail jones@foo.bar.example.com match jones@baz.example.com match jones@bbar.example.com fail jones@bar.example.com.com fail rednose@reindeer.org fail smythe@exzample.com fail teacher@make-an-example.com
  • Comment on Re: Re: Match all emails from all subdomains for a domain except one.. (tye)
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://282385]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2024-04-18 09:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found