Ed Lyons Posted February 14 Share Posted February 14 The app finds my character-styled spans correctly but ignores \& $& $MATCH and so forth. It inserts them as literals instead of replacing with the entire match. Yes, I selected regex in the Find dropdown. Windows 11. v2.04 Quote Link to comment Share on other sites More sharing options...
walt.farrell Posted February 15 Share Posted February 15 Publisher uses the Boost reg-ex library. You can find the full reference at the Boost.org site, or try regular-expression.info and select Boost as the variant for the syntax descriptions. \& is not Boost syntax for what you're trying to do. You might try \0 or $0. (I'm away from my computer and can't check right now.) 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.1.2, Apple Pencil 2, Magic Keyboard Mac: 2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.1.2 Link to comment Share on other sites More sharing options...
Ed Lyons Posted February 15 Author Share Posted February 15 0 syntax didn't work. From the help file -- "Affinity Publisher supports Perl and ECMAScript (with perl extensions) expressions. Regular expressions use the "C" or "POSIX" locale, while Locale Aware Regular Expressions use the locale inferred from the text being searched and locale aware collation is implied." I am a programmer and familiar with using regex. Used it successful in afpub 1.x. Followed syntax on "including www.regular-expressions.info and regexone.com." Quote Link to comment Share on other sites More sharing options...
Ed Lyons Posted February 15 Author Share Posted February 15 BTW. I left the Find box blank and I put in .* Find results were the same. Replace still did literal, not regex. Quote Link to comment Share on other sites More sharing options...
Staff Callum Posted February 20 Staff Share Posted February 20 Hi Ed Lyons, Please could you provide a sample document demonstrating this issue? Just to clarify this REGEX worked correctly in V1 but not in V2? Thanks C Quote Please tag me using @ in your reply so I can be sure to respond ASAP. Link to comment Share on other sites More sharing options...
Ed Lyons Posted February 21 Author Share Posted February 21 My particular file started in 2.0. I was referring to similar regex operations in 1.0. You can verify the issue with the following steps. Start a new file. Paste a bunch of text. Format random spans with a character style, e.g. strong. Check regular expressions in Find dropdown and search for Strong. All of them appear in the results list. Now try to bracket each occurrence with [\&] or [$&] or [$0]. Fail. Quote Link to comment Share on other sites More sharing options...
walt.farrell Posted February 23 Share Posted February 23 On 2/21/2023 at 12:39 PM, Ed Lyons said: Start a new file. Paste a bunch of text. Format random spans with a character style, e.g. strong. Check regular expressions in Find dropdown and search for Strong. All of them appear in the results list. Now try to bracket each occurrence with [\&] or [$&] or [$0]. Fail. What search string did you use? If you supply only a character style, and no actual regular expression, then I don't think there's a group for the referback (\&, $&, $0) to refer to. But having said that, there are errors in doing find/replace using .* as the search string, and I can't get any replaces to work in V1 (1.10.6) if I use .* and specify a character style. The Find works properly, but no Replaces work for me (even trying to replace with a fixed string like aaa for example). This seems to be true in 2.1.0.1709 Beta, too. Switching the Search string to \w* allows the Find to work, and then a replacement with [$0] or [$&] works, in both V1 and in 2.1 Beta. Using \& in the Replace field, though, just gives a literal & which I think is correct for Boost RegEx processing, with the options that I think Publisher is using. 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.1.2, Apple Pencil 2, Magic Keyboard Mac: 2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.1.2 Link to comment Share on other sites More sharing options...
Ed Lyons Posted February 23 Author Share Posted February 23 Match All should not need a referback?!! I tried both .* and only a character style and like you did not achieve success. You keep referring to Boost. Researching that, I see it claims Perl support, which makes sense with the help file statement. I am mentioning this because if Boost provides more or less support then maybe the help file needs to be updated to reflect that with better syntax sources? Your \w* workaround is giving me weird results, ie. duplicate replacement strings before and after and in between. It's trying hard!! Quote Link to comment Share on other sites More sharing options...
walt.farrell Posted February 23 Share Posted February 23 3 minutes ago, Ed Lyons said: Your \w* workaround is giving me weird results, ie. duplicate replacement strings before and after and in between. I'm not seeing that, and would need more details. 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.1.2, Apple Pencil 2, Magic Keyboard Mac: 2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.1.2 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.