
MarioC.86423 (Boerse Stuttgart) asked a question.
Hi, how to create a Group Rule with following conditions: IF User.Email "*@mail1.com" OR "*@mail2.com" AND NOT "*external@mail1.com" OR "*external@mail2.com"
I want to add all Users with Email Address ending @mail1.com or @mail2.com to a group without external employees they have a prefix external@mail1.com or external@mail2.com
Thank you

we use something like this, which you should be able to use to exclude users with a prefix:
!(isMemberOfGroup("NAME OF OUR GROUP")) AND !(String.stringContains(user.email,"@domain1.com") or String.stringContains(user.email,"@domain2.com"))
Hi Jeff,
thank you for answer but I can not with String.stringContains(user.email,"@domain1.com") exclude users with Email like givenname.surname.external@domain1.com.
givenname.surname.external@domain1.com contains @domain1.com
I understand that - my example shows how you can look for multiple items in a line. If you're still stuck, reach out to support - the Okta folks are great when helping with their expressions...
Got it 🙂
(String.stringContains(user.email,"@domain1.com") OR String.stringContains(user.email,"@domain2.com")) AND NOT String.stringContains(user.email,"external")
It works all users that contains "external" are excluded