MrJam
MrJam

Reputation: 1

TCL Partial String Match

Hoping a kind tcl guru can help me.

I have this string match, which works, to match an email address.

if { [string match "[email protected]" $emailFromAddress] } {
   set sendAutoReply 0

This works perfectly, however I want the string to ignore joe.blogs@ and only match on the thisdomain.com. The reasoning behind this, I don't want to auto reply to any one from a specific domain i.e. thisdomain.com and since that could be 1000's of email addresses (which I won't know) my thinking is to just match on the domain name.

Any thoughts on how best to do this, in a nice simple way?

Upvotes: 0

Views: 6840

Answers (1)

Shawn
Shawn

Reputation: 52579

Use a wildcard in the pattern instead of an explicit username?

if { [string match "*@thisdomain.com" $emailFromAddress] } {
   set sendAutoReply 0
}

Upvotes: 1

Related Questions