Re: help with sed-friendly regex with negative look-ahead syntax for sendmail

"Daniel Goldman [email protected] [sed-users]" <[email protected]> Thu, 23 Feb 2017 14:44:46 -0800
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
Maybe others will help. I will not help without a test input file, with 
the required output. That's the only way I can know that a solution is 
correct. Otherwise, I'm just guessing and wasting time.

I think you need a test file, too, to verify any proposed solution.

You know exactly which emails to reject. So I think you could easily 
create the test input and output files, to take care of all cases.

I'm not trying to be difficult. If you want to be effective using sed, 
you need to make good test files. In any case, thanks for posting.

On 2/23/2017 12:26 PM, Rob Kudyba [email protected] [sed-users] wrote:
> If you look at the guide in http://www.xiitec.com/blog/2009/02/25/using-regular-expressions-in-sendmail/, the goal is to reject emails from certain top level domains, such as .info, .us. and .bid but only if they have a subdomain. So:
> good: [email protected], so *@*.usbad: [email protected], so *@*.*.us
> This regex works:[a-zA-Z_0-9.-]+\@[a-zA-Z_0-9-]+?\.+[a-zA-Z_0-9.-]+?\.(us|info|bid)
> I'm trying to include/append to the beginning of the above regex, a negative look-ahead that would, in essence, ignore emails like:1) [email protected] so *@ci.*.us2) [email protected] (and state is one of the 50 states or DC) so *@*.ny.us (ny or any other state that is)
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------------------
> Posted by: Rob Kudyba <[email protected]>
> ------------------------------------
>