Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

regular expressions in transport rules

226 views
Skip to first unread message

osoviejo

unread,
Feb 13, 2008, 4:40:24 AM2/13/08
to
Why does "^<*use...@example.com>*$" (no quotes) match everything?

More generally, why is the regular expression engine in Exchange so
atrociously poor?

Since there is no tester for whatever flavor it is that Exchange uses,
I'm using a rule that applies to the Subject, and adds a header when it
matches.

Thanks.

Michael

Steven

unread,
Feb 13, 2008, 9:00:44 AM2/13/08
to
Can you give an example on what kinds of things you're looking to match?
As to testing your matching, you can simply use PowerShell to test:

"user...@domain.com" -match <pattern>

osoviejo

unread,
Feb 13, 2008, 2:58:59 PM2/13/08
to
Steven wrote:
> Can you give an example on what kinds of things you're looking to match?

The pattern ^<*use...@example.com>*$ is an example of what I'm trying to
match in this case (an email address with or without angle brackets).

However, it does not appear that that pattern operates as described in
the Exchange help--it matches everything. Is this a bug or am I missing
something in my interpretation of Exchange's regular expression facility?

> As to testing your matching, you can simply use PowerShell to test:
>
> "user...@domain.com" -match <pattern>

Are you referring to Select-String? I don't think that can test an
Exchange regular expression since Select-String uses .NET regular
expressions. Or is there another command that can be applied against
the Exchange version?

Thanks Steven.

Michael

osoviejo

unread,
Feb 14, 2008, 10:18:31 PM2/14/08
to
Why does "^<*use...@example.com>*$" (no quotes) match everything?

More generally, why is the regular expression engine in Exchange 2007 so
atrociously poor?

Also, is there a regex tester available? In lieu of one, I'm using a
rule that applies to the Subject, and adds a header when it matches. Is
there a more efficient way?

Thanks.

Michael

Rich Matheisen [MVP]

unread,
Feb 14, 2008, 10:55:15 PM2/14/08
to
osoviejo <osov...@newsgroup.nospam> wrote:

>Why does "^<*use...@example.com>*$" (no quotes) match everything?

No idea.

>More generally, why is the regular expression engine in Exchange 2007 so
>atrociously poor?

I can only guess that they thought a real RegEx engine would be too
slow (and I've certainly seen RegEx that would slow down even the
fastest engine!) to keep up with the number of patterns to match
against every message.

>Also, is there a regex tester available?

For E2K7? None that I know of. I suppose you could just use
Powershell.

--
Rich Matheisen
MCSE+I, Exchange MVP
MS Exchange FAQ at http://www.swinc.com/resource/exch_faq.htm
Don't send mail to this address mailto:h.p...@getronics.com
Or to these, either: mailto:h.p...@pinkroccade.com mailto:melvin.mcp...@getronics.com mailto:melvin.mcp...@pinkroccade.com

osoviejo

unread,
Feb 19, 2008, 3:47:34 AM2/19/08
to
Rich Matheisen [MVP] wrote:
> osoviejo <osov...@newsgroup.nospam> wrote:
>
>> Why does "^<*use...@example.com>*$" (no quotes) match everything?
>
> No idea.

So it's a bug? Should I report it, and if so, to whom?

>> Also, is there a regex tester available?
>
> For E2K7? None that I know of. I suppose you could just use
> Powershell.

Can you give an example of how I would test say, the above regex with
Powershell? Doesn't it use the .NET regex engine or is there a way to
make it use the Exchange version?

Thanks.

Michael

Rich Matheisen [MVP]

unread,
Feb 19, 2008, 9:06:57 PM2/19/08
to
osoviejo <osov...@newsgroup.nospam> wrote:

Just a simple example:

get-user <primary-proxy-address> | where {$_.WindowsEmailAddress
-match "^<*use...@example.com>*$"

0 new messages