{"id":5074,"date":"2015-07-20T04:00:25","date_gmt":"2015-07-20T08:00:25","guid":{"rendered":"https:\/\/americaneditor.wordpress.com\/?p=5074"},"modified":"2016-09-19T19:10:29","modified_gmt":"2016-09-20T01:10:29","slug":"lyonizing-word-from-easy-to-impossible-three-variations-on-a-theme","status":"publish","type":"post","link":"https:\/\/editorium.com\/archive\/lyonizing-word-from-easy-to-impossible-three-variations-on-a-theme\/","title":{"rendered":"Lyonizing Word: From Easy to Impossible \u2014 Three Variations on a Theme"},"content":{"rendered":"<p style=\"text-align:center;\"><em><strong>by Jack Lyon<\/strong><\/em><\/p>\n<p style=\"text-align:left;\">Rich Adin just keeps on escalating the difficulty of his requests. That\u2019s okay, because I appreciate a good challenge. Here\u2019s his latest:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">Okay, Jack, you solved the problem of reducing the number of authors from more than three down to three.<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">To see what Rich is talking about, please see my previous posts here: <a href=\"https:\/\/americaneditor.wordpress.com\/2015\/05\/27\/lyonizing-word-we-can-do-this-the-easy-way-or\/\" target=\"_blank\"><em>Lyonizing Word: We Can Do This the Easy Way, or . .\u00a0.<\/em><\/a> and <a href=\"https:\/\/americaneditor.wordpress.com\/2015\/06\/29\/lyonizing-word-the-easy-way-not-so-easy\/\" target=\"_blank\"><em>Lyonizing Word: The Easy Way, Not So\u00a0Easy<\/em><\/a>.<\/p>\n<p>Rich continues:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">But there is a caveat: the list of names needs to end with \u201cet al:\u201d. So let me pose three more variations.<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">Three?! Oh, all right. Here we go:<\/p>\n<h4 style=\"text-align:left;\">Variation 1<\/h4>\n<p style=\"text-align:left;\">How do I handle instances where the ending is punctuation other than \u201cet al:\u201d? For example, it could be a different punctuation mark than the colon or it could end with an author name and not \u201cet al\u201d (e.g., \u201cLyon J, Adin R, Carter TO, Jackson TT, Doe J, Smith K, Winger W:\u201d or \u201cLyon J, Adin R, Carter TO, Jackson TT, Doe J, Smith K, Winger W, Hoffnagle TTP.\u201d)<\/p>\n<p style=\"text-align:left;\">How do we handle instances where the ending is punctuation other than \u201cet al:\u201d? Here are Rich\u2019s examples, all laid out for our inspection:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">Lyon J, Adin R, Carter TO, Jackson TT, Doe J, Smith K, Winger W:<\/p>\n<p style=\"text-align:left;\">Lyon J, Adin R, Carter TO, Jackson TT, Doe J, Smith K, Winger W, Hoffnagle TTP.<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">As usual, the key is to find the \u201chandle,\u201d the unique elements we can grab to carry out our search. (For more on this, please see my article \u201c<a href=\"https:\/\/editorium.com\/archive\/whats-your-handle\/\" target=\"_blank\">What\u2019s Your Handle?<\/a>\u201d [2003] at the Editorium Update.)<\/p>\n<p style=\"text-align:left;\">In Rich\u2019s examples, the \u201chandles\u201d would have to be the colon that ends the first entry and the period that ends the second. Let\u2019s try modifying the wildcard string from the previous post for Lyonizing Word:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">([!^013]@, [!^013]@, [!^013]@, )[!^013]@([:.])<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">Here\u2019s what that means:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">Find any characters except a carriage return: [!^013]<br \/>\nrepeated any number of times: @<br \/>\nfollowed by a comma<br \/>\nfollowed by a space<br \/>\nrepeated three times<br \/>\nand enclosed in parentheses to form a \u201cgroup.\u201d<br \/>\nThen find any character except a carriage return: [!^013]<br \/>\nrepeated any number of times: @<br \/>\nfollowed by [:.] (specifying a colon or a period) in parentheses to form a group.<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">And we can use the following in the \u201cReplace With\u201d box:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">12<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">Here\u2019s what that means:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">Replace everything that was found<br \/>\nwith the text represented by group 1: 1<br \/>\nfollowed by the text represented by group 2: 2<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">But does that actually work? Well, sort of, Here\u2019s what we get:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">Lyon J, Adin R, Carter TO, :<br \/>\nLyon J, Adin R, Carter TO, .<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">Maybe that\u2019s close enough, as it would now be an easy matter to search for comma space colon and replace it with a colon, and to search for comma space period and replace it with a period. But if we want to refine our search string even further, we could use this:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">([!^013]@, [!^013]@, [!^013]@), [!^013]@([:.])<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">Here, we\u2019ve placed the comma and space following the third name outside the parenthetical group, so they\u2019re not included when the group is replaced by \/1. That actually solves the problem, if you want to get precise, giving us a result like this:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">Lyon J, Adin R, Carter TO:<br \/>\nLyon J, Adin R, Carter TO.<\/p>\n<\/blockquote>\n<h4 style=\"text-align:left;\">Variation 2<\/h4>\n<p style=\"text-align:left;\">Rich wrote:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">How can I revise the string to work even if there is no consistency in punctuation of names? For example, suppose the names are: \u201cLyon, J, Adin R, Carter T.O., Jackson TT, Doe, J.; Smith K; Winger, W; Hoffnagle TTP.\u201d<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">As given, this can\u2019t be done. Why? Because we\u2019ve lost the uniqueness of the comma \u201chandles\u201d that separate the names. For example, instead of this \u2014<\/p>\n<blockquote>\n<p style=\"text-align:left;\">Lyon J,<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">\u2014 we have this:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">Lyon, J,<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">And instead of this \u2014<\/p>\n<blockquote>\n<p style=\"text-align:left;\">Smith K,<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">\u2014 we have this:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">Smith K;<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">So again, as given, we can\u2019t fulfill Rich\u2019s request. But can we change the \u201cas given\u201d? Why, yes, we can!<\/p>\n<p style=\"text-align:left;\">We can search for a lowercase letter followed by a comma (at the end of a last name) and replace it with just the lowercase letter (and no comma):<\/p>\n<blockquote>\n<p style=\"text-align:left;\">Find what: ([a-z]),<br \/>\nReplace with: 1<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">We can search for a semicolon (which sometimes follows initials) and replace it with a comma:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">Find what: ;<br \/>\nReplace with: ,<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">Then we can use the same wildcard string we used earlier to fulfill Rich\u2019s request:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">Find what: ([!^013]@, [!^013]@, [!^013]@), [!^013]@([:.])<br \/>\nReplace with: 12<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">You may be wondering if these wildcard strings will affect the article titles and journal names and not just the author names. The answer is, it depends. I\u2019m assuming, for example, that the article titles and journal names don\u2019t include commas (just for purposes of illustration). But if they do, you may have to get creative. Let\u2019s take this as an example:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">Levy, D, Ehret G, Rice K, Verwoert G, Launer L, Dehghan A, Glazer N, Morrison A, Johnson A, Aspelund T, Ganesh S, Chasman D: Genome-wide association study of blood pressure, stress, and hypertension. Nature 2009, 41(6): 677-687.<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">See that comma after \u201cLevy\u201d? Above, we got rid of it with the following strings:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">Find what: ([a-z]),<br \/>\nReplace with: 1<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">But notice that this will also remove the commas after \u201cpressure\u201d and \u201cstress\u201d in the article title, which we don\u2019t want to do. The solution, again, comes down to handles. What do we have that sets off the article title and journal name? In this example, they\u2019re preceded by the colon after the author names (\u201cChasman D:\u201d) and followed by a carriage return (at the end of the citation). So here\u2019s a rather sneaky solution: Search for a colon followed by anything that isn\u2019t a carriage return until you come to a carriage return. Then replace whatever was found with itself (^&amp;) formatted as Hidden:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">Find what: :[!^013]@^013<br \/>\nReplace with (use Hidden formatting): ^&amp;<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">If you don\u2019t know how to replace using formatting, here\u2019s the secret:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">1. Put your cursor in the \u201cReplace with\u201d box.<br \/>\n2. Click the \u201cMore\u201d button if it\u2019s showing.<br \/>\n3. Click the \u201cFormat\u201d button on the bottom left.<br \/>\n4. Click \u201cFont.\u201d<br \/>\n5. Put a check in box labeled \u201cHidden.\u201d<br \/>\n6. Click the \u201cOK\u201d button.<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">Notice that you can replace with all kinds of formatting: styles, paragraph alignment, and so on. You can also use formatting in the \u201cFind what\u201d box! This is really powerful stuff, and if you didn\u2019t know about it before, now you can add it to your bag of tricks.<\/p>\n<p style=\"text-align:left;\">At any rate, with the article titles and journal names formatted as Hidden, you can make sure they actually are hidden by clicking the \u201cShow\/Hide\u201d button (with the pilcrow icon: \u00b6) on Word\u2019s \u201cHome\u201d tab. Then run your find and replace to remove commas from last names:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">Find what: ([a-z]),<br \/>\nReplace with: 1<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">Finally, unhide the article titles and journal names (after using \u201cShow\/Hide\u201d to display them):<\/p>\n<blockquote>\n<p style=\"text-align:left;\">Find what: (Hidden formatting)<br \/>\nReplace with: (Not Hidden formatting)<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">At that point, the commas will be gone from the authors\u2019 last names but preserved in the article titles and journal names.<\/p>\n<p style=\"text-align:left;\">By the way, if you\u2019re working on a Macintosh, you\u2019ll find that Word doesn\u2019t recognize the standard code for a carriage return (^013) while searching with wildcards. But never fear: you can still do what you need by \u201cescaping\u201d the code with a backslash and treating it as a range using square brackets. In other words, use this:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">[\u02c6013]<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">To specify not a carriage return, use the following:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">[!\u02c6013]<\/p>\n<\/blockquote>\n<h4 style=\"text-align:left;\">Variation 3<\/h4>\n<p style=\"text-align:left;\">Rich wrote:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">How can I adapt the wildcard string to delete those in excess of a certain number? For example, I have one client who wants up to ten author names listed and \u201cet al\u201d used only for names eleven and following. I would like to specify how many names I want retained and replace the excess with \u201cet al.\u201d For example, if there are fifteen names, delete the last five if ten are okay and replace them with \u201cet al.\u201d<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">Theoretically, we could do that as long as there\u2019s a \u201chandle\u201d that marks the end of the names. Let\u2019s take this example:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">Levy D, Ehret G, Rice K, Verwoert G, Launer L, Dehghan A, Glazer N, Morrison A, Johnson A, Aspelund T, Ganesh S, Chasman D: Genome-wide association study of blood pressure and hypertension. Nature 2009, 41(6): 677-687.<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">There are actually twelve names there, so we want to keep the first ten and replace the last two with \u201cet al.\u201d What\u2019s our handle? The colon after the last name (\u201cChasman D:\u201d) and before the article\u2019s title. So let\u2019s try an expansion of the wildcard search string we used in the previous post for Lyonizing Word. Instead of grouping three comma-separated names, we\u2019ll group ten:<\/p>\n<blockquote>\n<p style=\"text-align:left;\">Find what: ([!^013]@, [!^013]@, [!^013]@, [!^013]@, [!^013]@, [!^013]@, [!^013]@, [!^013]@, [!^013]@, [!^013]@,)[!^013]@(:)<br \/>\nReplace with: 1 et al.2<\/p>\n<\/blockquote>\n<p style=\"text-align:left;\">That would work if Word could handle it. But if you try it, Word will complain: \u201cThe Find What text contains a Pattern Match expression which is too complex.\u201d So now what? Honestly, I\u2019m not sure. I tried several other possibilities, none of which were successful. So if you, Gentle Reader, have any ideas about how to accomplish this seemingly impossible feat, I\u2019d love to hear them.<\/p>\n<p style=\"text-align:left;\">Wildcard searching can\u2019t do everything, but it can do an awful lot. As I\u2019ve said before, after all these years of editing, wildcard searching is the tool I rely on the most. I encourage you to invest the time needed to learn to use this tool, which will repay your efforts many times over. A good place to start is my free paper \u201c<a href=\"http:\/\/www.editorium.com\/freebies.htm\" target=\"_blank\">Advanced Find and Replace in Microsoft Word<\/a>.\u201d<\/p>\n<p style=\"text-align:left;\">I hope you\u2019ll also watch for my forthcoming <em>Wildcard Cookbook for Microsoft Word<\/em>. I\u2019m still trying to find more real-life examples for the book, so if you have some particularly sticky problems that might be solved using a wildcard search, I hope you\u2019ll <a href=\"http:\/\/editor@editorium.com\" target=\"_blank\">send them my way<\/a>. Maybe I can save you some work and at the same time figure out solutions that will help others in the future. Thanks for your help!<\/p>\n<p style=\"text-align:left;\"><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> <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> Both books will help you learn more about macros and how to use them.<\/em><\/p>\n<p style=\"text-align:left;\">For other Lyonizing Word essays at An American Editor, <a href=\"https:\/\/americaneditor.wordpress.com\/category\/lyonizing-word\/\" target=\"_blank\">Lyonizing Word at AAE<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<a href=\"https:\/\/editorium.com\/archive\/lyonizing-word-from-easy-to-impossible-three-variations-on-a-theme\/\" rel=\"bookmark\" title=\"Permalink to Lyonizing Word: From Easy to Impossible \u2014 Three Variations on a Theme\"><p>Wildcard searching can\u2019t do everything, but it can do an awful lot. As I\u2019ve said before, after all these years of editing, wildcard searching is the tool I rely on the most. I encourage you to invest the time needed to learn to use this tool, which will repay your efforts many times over.<\/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":[256,409],"tags":[267,446,1071,885],"class_list":{"0":"post-5074","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-contributor-article","7":"category-lyonizing-word","8":"tag-jack-lyon","9":"tag-macros","10":"tag-ms-word-wildcards","11":"tag-wildcard-find-replace","12":"h-entry","13":"hentry"},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3gfno-1jQ","_links":{"self":[{"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/posts\/5074","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=5074"}],"version-history":[{"count":1,"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/posts\/5074\/revisions"}],"predecessor-version":[{"id":6153,"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/posts\/5074\/revisions\/6153"}],"wp:attachment":[{"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/media?parent=5074"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/categories?post=5074"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/tags?post=5074"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}