{"id":5681,"date":"2016-05-02T04:00:44","date_gmt":"2016-05-02T08:00:44","guid":{"rendered":"https:\/\/americaneditor.wordpress.com\/?p=5681"},"modified":"2016-09-19T19:10:29","modified_gmt":"2016-09-20T01:10:29","slug":"lyonizing-word-using-the-find-what-expression-wildcard","status":"publish","type":"post","link":"https:\/\/editorium.com\/archive\/lyonizing-word-using-the-find-what-expression-wildcard\/","title":{"rendered":"Lyonizing Word: Using the \u201cFind What Expression\u201d Wildcard"},"content":{"rendered":"<p style=\"text-align:center;\"><strong>by Jack Lyon<\/strong><\/p>\n<p>Rich Adin recently sent me an interesting challenge. He was using his <a href=\"http:\/\/www.wordsnsync.com\/journals.php\" target=\"_blank\">EditTools Journal<\/a> feature\u00a0to mark journal titles in references. The power behind that useful tool comes from lists of incorrectly styled references with corresponding correctly styled references. He creates a separate list for each reference style. The list he sent me was for AMA style, in which the reference uses the PubMed abbreviation followed by a period. It looks like something like this:<\/p>\n<p style=\"padding-left:60px;\">A Gesamte Exp Med, | cyan -&gt; Z Gesamte Exp Med.<br \/>\nA Gesamte Exp Med. | cyan -&gt; Z Gesamte Exp Med.<br \/>\nA JR | cyan -&gt; AJR Am J Roentgenol.<br \/>\nA M A Arch Ind Hyg Occup Med. | green<br \/>\nA of LTC | cyan -&gt; Ann Longterm Care.<br \/>\nA of LTC, | cyan -&gt; Ann Longterm Care.<br \/>\nA of LTC. | cyan -&gt; Ann Longterm Care.<br \/>\nA&amp;D | cyan -&gt; Aging Dis.<br \/>\nA&amp;D, | cyan -&gt; Aging Dis.<br \/>\nA&amp;D. | cyan -&gt; Aging Dis.<br \/>\nA. M. A. Arch. Derm | cyan -&gt; AMA Arch Derm.<br \/>\nA. M. A. Arch. Derm, | cyan -&gt; AMA Arch Derm.<br \/>\nA. M. A. Arch. Derm. | cyan -&gt; AMA Arch Derm.<\/p>\n<p>The text to the left of the pipe (|) is how the entry might (incorrectly) appear in the references supplied by the author; the entry to the right is how it <em>should <\/em>appear. Each entry includes a color, either cyan or green, which tells the program to use that color in highlighting the reference.<\/p>\n<p>Rich knew that some of the entries included duplicates, like this:<\/p>\n<p style=\"padding-left:60px;\">Arch Intern Med. | cyan -&gt; Arch Intern Med.<\/p>\n<p>In other words, the item on the left was identical to the item on the right, which meant that it shouldn\u2019t be marked. That also meant the entry didn\u2019t need to be on the list at all. But the real problem was that Rich\u2019s reference list included more than 117,000 entries!<\/p>\n<p>Rich\u2019s challenge? Use wildcard find and replace to remove such entries, thus shortening the list and preventing unnecessary marking.<\/p>\n<p>First, let\u2019s look at that entry again to see what we might need to do:<\/p>\n<p style=\"padding-left:60px;\">Arch Intern Med. | cyan -&gt; Arch Intern Med.<\/p>\n<p>There\u2019s a pipe symbol (|) in the middle, which gives us something to differentiate the left side of the entry from the right side of the entry. So we might set up the first part of our wildcard string to look like this:<\/p>\n<p style=\"padding-left:60px;\">([!^013]@) |<\/p>\n<p>That tells Word to find any character <em>except<\/em> a carriage return, an unspecified number of times, until it comes to a space followed by a pipe symbol.<\/p>\n<p>The wildcard for a carriage return is:<\/p>\n<p style=\"padding-left:60px;\">^013<\/p>\n<p>The wildcard for \u201cexcept\u201d is:<\/p>\n<p style=\"padding-left:60px;\">!<\/p>\n<p>And we have to put both of those in square brackets so Word knows that\u2019s a <em>set<\/em> of characters. (After all, [!^013] finds <em>any<\/em> character, no matter what it is, <em>unless<\/em> it\u2019s a carriage return.)<\/p>\n<p>The wildcard for \u201can unspecified number of times\u201d is:<\/p>\n<p style=\"padding-left:60px;\">@<\/p>\n<p>Finally, we have to put all of that into a \u201cgroup\u201d by enclosing it with parentheses. And that\u2019s <em>important.<\/em> You\u2019ll see why in a minute.<\/p>\n<p>Testing that part of our search string, we see that, yes, indeed, it finds the following:<\/p>\n<p style=\"padding-left:60px;\">Arch Intern Med. |<\/p>\n<p>In fact, it finds the beginning of each entry, which is just what we want.<\/p>\n<p>Now let\u2019s look at the right side of our entry:<\/p>\n<p style=\"padding-left:60px;\">\u00a0cyan -&gt; Arch Intern Med.<\/p>\n<p>You can\u2019t see it here, but there\u2019s a space in front of \u201ccyan\u201d \u2014 the space that follows the pipe symbol. So we need to include that space in our search string, along with the word \u201ccyan\u201d (in the following examples, I use [space] to represent a space so you can see it; [space] should not actually be entered; use a real space created by pressing the space bar):<\/p>\n<p style=\"padding-left:60px;\">[space]cyan<\/p>\n<p>There\u2019s also a space <em>after<\/em> cyan, so we\u2019ll need to include that as well.<\/p>\n<p style=\"padding-left:60px;\">[space]cyan[space]<\/p>\n<p>That needs to be followed by a hyphen, a right angle bracket, and yet another space, like this:<\/p>\n<p style=\"padding-left:60px;\">[space]cyan[space]-&gt;[space]<\/p>\n<p>But now you may be wondering why I put a backslash in front of the angle bracket. It\u2019s because the angle bracket is <em>itself<\/em> a wildcard (a subject for another day), so we need to tell Word we\u2019re using it as an actual character, which is what the backslash does.<\/p>\n<p>Finally, the rest of our search string looks like this:<\/p>\n<p style=\"padding-left:60px;\">1^013<\/p>\n<p>This part of the string \u2014<\/p>\n<p style=\"padding-left:60px;\">1<\/p>\n<p>\u2014 is the \u201cFind What Expression\u201d wildcard, which is what this article is about, and it certainly took us a long time to get to it!<\/p>\n<p>Remember back when we grouped the very first part of our search string in parentheses?<\/p>\n<p style=\"padding-left:60px;\">([!^013]@)<\/p>\n<p>That \u201cgroup\u201d is the \u201cexpression\u201d that the 1 wildcard represents. In algebraic terms:<\/p>\n<p style=\"padding-left:60px;\">1 = ([!^013]@)<\/p>\n<p>And that means 1 will find whatever is found by the ([!^013]@) expression, which, my friend, is extremely cool, because it will allow us to weed out the duplicate entries on our reference list\u2014entries like this:<\/p>\n<p style=\"padding-left:60px;\">Arch Intern Med. | cyan -&gt; Arch Intern Med.<\/p>\n<p>Now, for the first time, let\u2019s look at our entire search string:<\/p>\n<p style=\"padding-left:60px;\">([!^013]@) | cyan -&gt; 1^013<\/p>\n<p>By now, you probably understand this quite well. The string finds any characters <em>except<\/em> a carriage return until it comes to a space and a pipe symbol; then it finds a space, the word \u201ccyan,\u201d and another space, followed by a hyphen, a right angle bracket, and a space. Finally (and most importantly), it finds whatever was found by the parenthetical group, followed by a carriage return.<\/p>\n<p>Now we simply need to make sure that Word\u2019s \u201cReplace with\u201d box is empty and click \u201cReplace All.\u201d All of those unnecessary entries will be deleted. (We\u2019ll need to repeat with \u201cgreen\u201d for the entries that don\u2019t include \u201ccyan.\u201d)<\/p>\n<p>Which would you rather do: Find and delete such entries manually (with just 117,000 to look through) or have Word do it automatically?<\/p>\n<p>That\u2019s the power of the \u201cFind What Expression\u201d wildcard. In future articles, I\u2019ll show you more uses for this wonderful tool, along with other Word wildcards.<\/p>\n<p><em>Jack Lyon (<\/em><a href=\"mailto:editor@editorium.com\"><em>editor@editorium.com<\/em><\/a><em>)\u00a0owns and operates the <\/em><a title=\"The Editorium\" href=\"http:\/\/www.editorium.com\" target=\"_blank\"><em>Editorium<\/em><\/a><em>, which provides macros and information to help editors and publishers do mundane tasks quickly and efficiently. He is the author of <\/em><a title=\"Microsoft Word for Publishing Professionals\" href=\"http:\/\/www.editorium.com\/msword4pubpros.htm\" target=\"_blank\">Microsoft Word for Publishing Professionals<\/a>, <a href=\"http:\/\/www.barnesandnoble.com\/w\/wildcard-cookbook-for-microsoft-word-jack-lyon\/1122656660\" target=\"_blank\">Wildcard Cookbook for Microsoft Word<\/a>, <em>and of <\/em><a title=\"Macro Cookbook at Barnes &amp; Noble\" href=\"http:\/\/www.barnesandnoble.com\/w\/macro-cookbook-for-microsoft-word-jack-m-lyon\/1107868228?ean=9781434103321\" target=\"_blank\">Macro Cookbook for Microsoft Word<\/a><em>.<\/em><em> Both books will help you learn more about macros and how to use them.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<a href=\"https:\/\/editorium.com\/archive\/lyonizing-word-using-the-find-what-expression-wildcard\/\" rel=\"bookmark\" title=\"Permalink to Lyonizing Word: Using the \u201cFind What Expression\u201d Wildcard\"><p>by Jack Lyon Rich Adin recently sent me an interesting challenge. He was using his EditTools Journal feature\u00a0to mark journal titles in references. The power behind that useful tool comes from lists of incorrectly styled references with corresponding correctly styled references. He creates a separate list for each reference style. The list he sent me [&hellip;]<\/p>\n<\/a>","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[77,256,409],"tags":[767,1369,1370,267,1371],"class_list":{"0":"post-5681","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-computers-and-software","7":"category-contributor-article","8":"category-lyonizing-word","9":"tag-contributor-article-2","10":"tag-finding-duplicates","11":"tag-grouping","12":"tag-jack-lyon","13":"tag-wildcards","14":"h-entry","15":"hentry"},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3gfno-1tD","_links":{"self":[{"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/posts\/5681","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/comments?post=5681"}],"version-history":[{"count":1,"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/posts\/5681\/revisions"}],"predecessor-version":[{"id":6242,"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/posts\/5681\/revisions\/6242"}],"wp:attachment":[{"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/media?parent=5681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/categories?post=5681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/tags?post=5681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}