{"id":7655,"date":"2017-08-15T13:59:40","date_gmt":"2017-08-15T17:59:40","guid":{"rendered":"http:\/\/nycphantom.com\/journal\/?p=7655"},"modified":"2017-08-15T14:01:15","modified_gmt":"2017-08-15T18:01:15","slug":"outlook-rules-with-wildcards","status":"publish","type":"post","link":"http:\/\/nycphantom.com\/journal\/?p=7655","title":{"rendered":"To Consider: Outlook Rules with Wildcards"},"content":{"rendered":"<p>Outlook doesn't like using Wildcards so much, but there's some tips:\u00a0<a href=\"https:\/\/www.slipstick.com\/outlook\/rules\/create-a-rule-with-wildcards\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.slipstick.com\/outlook\/rules\/create-a-rule-with-wildcards\/<\/a><\/p>\n<p>Outlook doesn't support wildcards in rules, so you can't use use a * or ? character for wildcards. Instead, just specify the string you want to match. For example, if you want to match anything with \"foo\" in the subject text, then any the following would cause the rule to fire:<\/p>\n<p>Foobar<br \/>\nFools<br \/>\ntofoo<\/p>\n<p>Note that the Rules Wizard supports wildcarding for e-mail addresses. By using the \"with specific words in the recipient's address\" and \"with specific words in the sender's address\" conditions, you can set rules for everyone from a particular domain, for example. See\u00a0<a href=\"https:\/\/www.slipstick.com\/outlook\/rules\/create-rules-that-apply-to-an-entire-domain\/\">Creating Rules that Apply to an Entire Domain<\/a>\u00a0for more information.<\/p>\n<p>However, these address rules do not work for Exchange Server recipients since the Exchange server addresses do not show up in the message header. To apply a rule to addresses within your Exchange organization (or exclude them), use @ as the word in the address (or exclude messages with @ in the address). See\u00a0<a href=\"https:\/\/www.outlook-tips.net\/how-to\/filter-blank-senders\/\">Creating a Rule to Filter Blank Senders<\/a>\u00a0for more information.<\/p>\n<h2>Display names<\/h2>\n<p>While a partial word filter won't work in all circumstances, you can use it to filter the display name of senders. For example, this rule will filter messages from Forum Administrator<\/p>\n<p><a title=\"\" href=\"https:\/\/static.slipstick.com\/images\/2011\/rules\/rule-test.png\" data-rel=\"lightbox-gallery-9hDH\" data-lightbox-gallery=\"lightbox-gallery-9hDH\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-41900\" src=\"https:\/\/static.slipstick.com\/images\/2011\/rules\/rule-test.png\" sizes=\"auto, (max-width: 436px) 100vw, 436px\" srcset=\"https:\/\/cdn.slipstick.com\/images\/2011\/rules\/rule-test.png 436w, https:\/\/cdn.slipstick.com\/images\/2011\/rules\/rule-test-325x60.png 325w\" alt=\"rule test\" width=\"436\" height=\"81\" \/><\/a><\/p>\n<p>Tip:\u00a0<a href=\"https:\/\/www.slipstick.com\/outlook\/rules\/create-rules-that-apply-to-an-entire-domain\/\">Cancel the Check names dialog<\/a>\u00a0when adding the name to the people or group field:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-41895\" src=\"https:\/\/static.slipstick.com\/images\/2011\/rules\/wildcard-rule.png\" sizes=\"auto, (max-width: 452px) 100vw, 452px\" srcset=\"https:\/\/media.slipstick.com\/images\/2011\/rules\/wildcard-rule.png 452w, https:\/\/media.slipstick.com\/images\/2011\/rules\/wildcard-rule-375x450.png 375w, https:\/\/media.slipstick.com\/images\/2011\/rules\/wildcard-rule-271x325.png 271w\" alt=\"Create a rule to filter partial display names\" width=\"452\" height=\"542\" \/><\/p>\n<h2>Run a Script rule<\/h2>\n<p>When a rule that looks for partial words isn't working, you can use a run a script rule. This example shows how to filter for the Sender's display name, but it can be used with any Outlook email field.<\/p>\n<pre lang=\"vbscript\">Sub CheckSpam(Item As Outlook.MailItem)\r\n  If InStr(LCase(Item.SenderName), \"pfizer\") Then\r\n    Item.Delete\r\n  End If\r\nEnd Sub\r\n<\/pre>\n<h3>Using Wildcards in a Script<\/h3>\n<p>You can use wildcards in a script, either by using the method below or\u00a0<a href=\"https:\/\/www.slipstick.com\/developer\/regex-parse-message-text\/\">regex<\/a>.<\/p>\n<blockquote>\n<div>So on this topic... how about moving all messages that say<br \/>\nInvoice AI-SO-11786 from My Company<br \/>\nwhere the invoice number changes each time?<\/div>\n<\/blockquote>\n<p>Assuming AI-SO- is in every invoice and only the numbers change, the next example shows one way to use wildcards in a script. It works with 5 or more digits (or characters) following ai-so-. If the letters are always upper case, you could get away with removing LCASE and using upper case letters in the macro.<\/p>\n<p>The rule looks for the word\u00a0<em>invoice\u00a0<\/em>in the subject or body and if found, runs this macro to check the subject.<\/p>\n<pre lang=\"vbscript\">Sub MoveInvoices(Item As Outlook.MailItem)\r\nDim MoveFolder As Folder\r\nSet MoveFolder = Session.GetDefaultFolder(olFolderInbox)\r\nSet MoveFolder = MoveFolder.Folders(\"Move\")\r\n     If LCase(Item.Subject) Like LCase(\"*ai-so-?????*\") = True Then\r\n      Item.Move MoveFolder\r\n  End If\r\nEnd Sub\r\n<\/pre>\n<p>See\u00a0<a href=\"https:\/\/www.slipstick.com\/outlook\/rules\/outlooks-rules-and-alerts-run-a-script\/\">Outlook's Rules and Alerts: Run a Script<\/a>\u00a0for more information on using a run a script rule.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Outlook doesn't like using Wildcards so much, but there's some tips:\u00a0https:\/\/www.slipstick.com\/outlook\/rules\/create-a-rule-with-wildcards\/ Outlook doesn't support wildcards in rules, so you can't use use a * or ? character for wildcards. Instead, just specify the string you want to match. For example, &hellip; <a href=\"http:\/\/nycphantom.com\/journal\/?p=7655\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-7655","post","type-post","status-publish","format-standard","hentry","category-technical"],"_links":{"self":[{"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/posts\/7655","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7655"}],"version-history":[{"count":3,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/posts\/7655\/revisions"}],"predecessor-version":[{"id":7658,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/posts\/7655\/revisions\/7658"}],"wp:attachment":[{"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7655"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7655"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}