we have the html text of an email and wish to search for banned content we use
[^@\-\.]\bsomedomain\.com\b

this will pick out somedomain.com but not fred@somedomain.com which is correct

but it will find fred@sub1.somedomain.com

how could you alter the above expression to exclude all words that contain an @ not knowing where it maybe in the string

Re: find string if not preceded with @ anywhere in the string by Jared

Jared
Sat Jul 24 10:54:03 CDT 2004

Paul,
This one should work, I found it on
http://www.regexlib.com/DisplayPatterns.aspx and modified it a little, (very
little)
Jared

\b(?<Address>(?:[0-9a-zA-Z](?:[-.\w]*[0-9a-zA-Z])*@(?:[0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9}))\b

"Paul Durrant" <Paul Durrant@discussions.microsoft.com> wrote in message
news:94F06612-0CFD-4140-B67D-26CF54715753@microsoft.com...
> we have the html text of an email and wish to search for banned content we
> use
> [^@\-\.]\bsomedomain\.com\b
>
> this will pick out somedomain.com but not fred@somedomain.com which is
> correct
>
> but it will find fred@sub1.somedomain.com
>
> how could you alter the above expression to exclude all words that contain
> an @ not knowing where it maybe in the string
>
>



Re: find string if not preceded with @ anywhere in the string by PaulDurrant

PaulDurrant
Sat Jul 24 11:27:03 CDT 2004

Not quite what i'm looking for, i'm actually looking for specific words in html emails, but not if they are part of an email address

example


----- Original Message -----
From: <faxadmin@my.faxservice.com>
To: <faxerrors@myfaxservice.com>
Sent: Saturday, July 24, 2004 3:31 PM
Subject: Fax from 015616 received (tracking no. 141823)


> A new fax has arrived from my.faxservice.com


i want to find the word my.faxservice.com but not when its an emailaddress


Thanks Paul








"Jared" wrote:

> Paul,
> This one should work, I found it on
> http://www.regexlib.com/DisplayPatterns.aspx and modified it a little, (very
> little)
> Jared
>
> \b(?<Address>(?:[0-9a-zA-Z](?:[-.\w]*[0-9a-zA-Z])*@(?:[0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9}))\b
>
> "Paul Durrant" <Paul Durrant@discussions.microsoft.com> wrote in message
> news:94F06612-0CFD-4140-B67D-26CF54715753@microsoft.com...
> > we have the html text of an email and wish to search for banned content we
> > use
> > [^@\-\.]\bsomedomain\.com\b
> >
> > this will pick out somedomain.com but not fred@somedomain.com which is
> > correct
> >
> > but it will find fred@sub1.somedomain.com
> >
> > how could you alter the above expression to exclude all words that contain
> > an @ not knowing where it maybe in the string
> >
> >
>
>
>

Re: find string if not preceded with @ anywhere in the string by Jared

Jared
Sat Jul 24 12:43:03 CDT 2004

Paul,
I guess I misunderstood the original question, try this one. If it
doesn't fit your needs do a little research on lookahead and lookbehind,
both allow you to match a specific pattern without consuming them. Let me
know how this works!
Jared

[^\@\.]\b(?<=[^@])(?<url>(\w+[\w\.][\w\.]?)+\.\w+)+(?=[^@])\b


"Paul Durrant" <PaulDurrant@discussions.microsoft.com> wrote in message
news:4BB4287B-AB50-4053-92E2-226C87F23D66@microsoft.com...
> Not quite what i'm looking for, i'm actually looking for specific words in
> html emails, but not if they are part of an email address
>
> example
>
>
> ----- Original Message -----
> From: <faxadmin@my.faxservice.com>
> To: <faxerrors@myfaxservice.com>
> Sent: Saturday, July 24, 2004 3:31 PM
> Subject: Fax from 015616 received (tracking no. 141823)
>
>
>> A new fax has arrived from my.faxservice.com
>
>
> i want to find the word my.faxservice.com but not when its an
> emailaddress
>
>
> Thanks Paul
>
>
>
>
>
>
>
>
> "Jared" wrote:
>
>> Paul,
>> This one should work, I found it on
>> http://www.regexlib.com/DisplayPatterns.aspx and modified it a little,
>> (very
>> little)
>> Jared
>>
>> \b(?<Address>(?:[0-9a-zA-Z](?:[-.\w]*[0-9a-zA-Z])*@(?:[0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9}))\b
>>
>> "Paul Durrant" <Paul Durrant@discussions.microsoft.com> wrote in message
>> news:94F06612-0CFD-4140-B67D-26CF54715753@microsoft.com...
>> > we have the html text of an email and wish to search for banned content
>> > we
>> > use
>> > [^@\-\.]\bsomedomain\.com\b
>> >
>> > this will pick out somedomain.com but not fred@somedomain.com which
>> > is
>> > correct
>> >
>> > but it will find fred@sub1.somedomain.com
>> >
>> > how could you alter the above expression to exclude all words that
>> > contain
>> > an @ not knowing where it maybe in the string
>> >
>> >
>>
>>
>>