List Info

Thread: Regex that matches anything *but* the described pattern?




Regex that matches anything *but* the described pattern?
user name
2006-10-16 20:36:53
Hi All,

i currently have a spam filter regex that matches a certain
classes of
addresses.  For example, I have:

support..*mydomain.com

Which matches anything that starts with "support."
and ends in
"mydomain.com"

However, I would like to also have a regex which will match
anything
that does *not* begin with "support." and *does*
end in "mydomain.com"

I haven't been able to figure this one out.  Can anybody
help me out?

The only negation operator I was able to find related to
character
classes (^), not enter strings, which is what I want.

  -Josh


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://grou
ps-beta.google.com/group/regex
-~----------~----~----~----~------~----~------~--~---

Regex that matches anything *but* the described pattern?
user name
2006-10-17 20:34:23
Joshua Beall wrote:
> Hi All,
>
> i currently have a spam filter regex that matches a
certain classes of
> addresses.  For example, I have:
>
> support..*mydomain.com
>
> Which matches anything that starts with
"support." and ends in
> "mydomain.com"
>
> However, I would like to also have a regex which will
match anything
> that does *not* begin with "support." and
*does* end in "mydomain.com"

Just use a negative look ahead, like:

  ^(?!support).*mydomain.com$

Xicheng


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://grou
ps-beta.google.com/group/regex
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )