philipt18 Posted January 31 Share Posted January 31 Maybe there's a way to do this already, and I assume it can be done using regular expressions, but I'd like an easier way to do this as I need to do it all the time. When searching for a specific word, there's no easy way to search for a word by itself. For example, I was looking for the word par. As you might imagine in a large text that shows up many times in other words like part, separate, party, depart, apartment, etc. I want to find it only when it's by itself. I can try adding a space before and after it, but that won't find it if there is a comma, period, parenthesis, or quote. In fact, it won't find it even if there's a footnote after it (I don't think footnote numbers should affect searches - so suggestion to fix that as well). I'd like it so if I search for par and click a checkbox for finding the whole word, it would find it no matter what other non-letter characters are on either side of it. Bonus if you can turn on and off variant search as well (finding plural and singular, adjective and adverb forms, etc.) Quote Link to comment Share on other sites More sharing options...
Bit Disappointed Posted January 31 Share Posted January 31 Hi @philipt18 The easy and straightforward solution for everyone: This does replace WORD even if if there is a comma, period, parenthesis, or quote before or after the word: "WORD" ,WORD. (WORD) Regular expressions are something I have developers create for me, but slowly I've accumulated an arsenal of variations that I can adapt for my own use. They are complex, but can really be powerful when you truly need tricks. To create a regular expression (regex) that matches the word "par" as a standalone word in a text, regardless of the surrounding punctuation or special characters, you can use the following regex expression. This regex will match "par" when it appears by itself, even if it's followed by a comma, period, parenthesis, or other non-letter characters. \bpar\b It will look like this in the search replace dialog: Regarding the bonus request for variant search (like finding plural, singular, adjective, and adverb forms), regular expressions are not inherently equipped to handle linguistic variations. To achieve this, you'd typically need a more advanced text processing tool or library that understands language context and morphology. However, a basic approach could be to list the variations explicitly in the regex, separated by a pipe | which acts as an "OR" operator. For example, if you want to find "par", "pars", and "pare" (imaginary variants for illustration), you could use: \b(par|pars|pare)\b I hope this helps. 🙂 philipt18 and Old Bruce 2 Quote Experienced Quality Assurance Manager - I strive for excellence in complex professional illustrations through efficient workflows in modern applications, supporting me in achieving my and my colleagues' goals through the most achievable usability and contemporary, easy-to-use user interfaces. Link to comment Share on other sites More sharing options...
philipt18 Posted January 31 Author Share Posted January 31 Thank you, that's helpful, although still a lot of work when doing things like indexing hundreds of words. It would be great if Serif could add this as a standard feature. Bit Disappointed 1 Quote Link to comment Share on other sites More sharing options...
Bit Disappointed Posted January 31 Share Posted January 31 Ah, a linguistic replacement? I believe we're on the brink of what DTP programs are expected to offer in terms of attractive features, but let's see what AI makes the new normal in the not-too-distant future. As long as one can easily specify something that yields a predictable result. It's likely to become more popular with the general public and customer base than regex. Quote Experienced Quality Assurance Manager - I strive for excellence in complex professional illustrations through efficient workflows in modern applications, supporting me in achieving my and my colleagues' goals through the most achievable usability and contemporary, easy-to-use user interfaces. Link to comment Share on other sites More sharing options...
philipt18 Posted January 31 Author Share Posted January 31 2 minutes ago, Bit Arts said: Ah, a linguistic replacement? I believe we're on the brink of what DTP programs are expected to offer in terms of attractive features, but let's see what AI makes the new normal in the not-too-distant future. As long as one can easily specify something that yields a predictable result. It's likely to become more popular with the general public and customer base than regex. Actually I just meant the whole word searching without needing to use regex. However, Publisher already does do some minor linguistic replacement when, for example, you type in a plural word when adding a marker, if the singular of the word exists as an index topic, it will still suggest it. I would guess it's not using any fancy AI to do this, just simply searching for words without -s or -es at the end, but even that can be helpful sometimes. Quote Link to comment Share on other sites More sharing options...
Bit Disappointed Posted January 31 Share Posted January 31 4 minutes ago, philipt18 said: Actually I just meant the whole word searching without needing to use regex. However, Publisher already does do some minor linguistic replacement when, for example, you type in a plural word when adding a marker, if the singular of the word exists as an index topic, it will still suggest it. I would guess it's not using any fancy AI to do this, just simply searching for words without -s or -es at the end, but even that can be helpful sometimes. "This does replace WORD even if if there is a comma, period, parenthesis, or quote before or after the word: "WORD" ,WORD. (WORD)" This worked for me without regex. 🙂 Quote Experienced Quality Assurance Manager - I strive for excellence in complex professional illustrations through efficient workflows in modern applications, supporting me in achieving my and my colleagues' goals through the most achievable usability and contemporary, easy-to-use user interfaces. Link to comment Share on other sites More sharing options...
philipt18 Posted January 31 Author Share Posted January 31 That's helpful, although it doesn't work if there is a footnote number after the word, which I guess is a bug. Quote Link to comment Share on other sites More sharing options...
walt.farrell Posted January 31 Share Posted January 31 5 hours ago, philipt18 said: although still a lot of work when doing things like indexing hundreds of words Can't you do that searching via the Index panel, rather than Find and Replace? In any case, if you choose Whole Word from the format menu for the Find field, it should be remembered for you. Quote -- Walt Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases PC: Desktop: Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 Laptop: Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU. iPad: iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard Mac: 2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1 Link to comment Share on other sites More sharing options...
Bit Disappointed Posted January 31 Share Posted January 31 30 minutes ago, philipt18 said: That's helpful, although it doesn't work if there is a footnote number after the word, which I guess is a bug. It sure sounds like a bug. I can only recommend that you report it here (macOS) or maybe here (Win). Quote Experienced Quality Assurance Manager - I strive for excellence in complex professional illustrations through efficient workflows in modern applications, supporting me in achieving my and my colleagues' goals through the most achievable usability and contemporary, easy-to-use user interfaces. Link to comment Share on other sites More sharing options...
philipt18 Posted January 31 Author Share Posted January 31 1 hour ago, walt.farrell said: Can't you do that searching via the Index panel, rather than Find and Replace? In any case, if you choose Whole Word from the format menu for the Find field, it should be remembered for you. If you're trying to search the text so you can add instances to the index, then searching in the index doesn't help you. Quote Link to comment Share on other sites More sharing options...
walt.farrell Posted February 1 Share Posted February 1 2 hours ago, philipt18 said: If you're trying to search the text so you can add instances to the index, then searching in the index doesn't help you. If you select a word in the Index panel, there is a Find option to find all other occurrences of the word in that .afpub file, where you can then optionally add them to the Index. Quote -- Walt Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases PC: Desktop: Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 Laptop: Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU. iPad: iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard Mac: 2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1 Link to comment Share on other sites More sharing options...
philipt18 Posted February 1 Author Share Posted February 1 29 minutes ago, walt.farrell said: If you select a word in the Index panel, there is a Find option to find all other occurrences of the word in that .afpub file, where you can then optionally add them to the Index. I forgot about that one, thanks. Interestingly that search finds words with footnotes after them, while the main search does not. walt.farrell 1 Quote Link to comment Share on other sites More sharing options...
philipt18 Posted February 1 Author Share Posted February 1 One downside of this feature is that I someone put explanations in parenthesis after my index topics, and this feature obviolusly doesnt work in that case. I need to remove that, do the search, then put it back. It might be nice to have an index topic, and a 'Display as' field to allow you to modify how it's displayed. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.