walt.farrell Posted September 5, 2020 Share Posted September 5, 2020 1 hour ago, MikeW said: Yes, it is currently on. Did you press the Reset button like I asked? Why? No matter the state of RegexBuddy's case sensitivity flag of the regex type we are both displaying, if/when I press Reset, RegexBuddy turns Case sensitive on. I did not, as it was included why you were asking, and because the discussion is about the behavior of [[:lower:]] when case sensitivity is turned off. All that pressing reset there does is demonstrate what RegExBuddy's default state is. It says nothing about Publisher's default state, and I don't feel like doing a Ctrl restart or creating another user on the system to figure that out. I would agree that having that option hidden is not ideal on Publisher. But whichever way the user has it set, the processing matches what Boost is coded to do. So Publisher does not have a bug on the actual regex processing. It has a UI flaw in hiding the option, potentially a flaw in the initial value of the option (but someone would need to confirm that). Remembering the user's choice is also not a flaw, in my opinion, and users would complain if it didn't. The function does work unintuitively given that [[:lower:]] can match upper-case characters, but that's not the fault of Publisher. And however unintuitive it is, it might be correct given the number of regex engines that work that way. 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...
v_kyr Posted September 5, 2020 Share Posted September 5, 2020 The boost lib reg expr docs tell how and what settings/flags are supported in that implementation ... Perl Reg Expression Syntax Options for Perl Reg Expressions (see icase and collate there) Further from their FAQ ... Quote Q. Why don't character ranges work properly (POSIX mode only)? A. The POSIX standard specifies that character range expressions are locale sensitive - so for example the expression [A-Z] will match any collating element that collates between 'A' and 'Z'. That means that for most locales other than "C" or "POSIX", [A-Z] would match the single character 't' for example, which is not what most people expect - or at least not what most people have come to expect from regular expression engines. For this reason, the default behaviour of Boost.Regex (perl mode) is to turn locale sensitive collation off by not setting the regex_constants::collate compile time flag. However if you set a non-default compile time flag - for example regex_constants::extended or regex_constants::basic, then locale dependent collation will be enabled, this also applies to the POSIX API functions which use either regex_constants::extended or regex_constants::basic internally. [Note - when regex_constants::nocollate in effect, the library behaves "as if" the LC_COLLATE locale category were always "C", regardless of what its actually set to - end note]. Some test and example progs for those who know and work with C++ etc. ... so the whole also depends on what flags are used and how the lib is overall compiled and integrated. Quote ☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan ☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2 Link to comment Share on other sites More sharing options...
MikeW Posted September 5, 2020 Share Posted September 5, 2020 12 minutes ago, walt.farrell said: I did not, as it was included why you were asking, and because the discussion is about the behavior of [[:lower:]] when case sensitivity is turned off. ... You were the person who brought up RegexBuddy and how it operates. My attempt was to get you to just press the reset button to demonstrate what RegexBuddy's default setting is futile. At least as regards admitting you were incorrectly representing how defaults in RegexBuddy work and that they comply to Boost's documentation. Life is just too short arguing with wall. So, another subject (RegexBuddy) is dead to me too. Quote Link to comment Share on other sites More sharing options...
lacerto Posted September 5, 2020 Share Posted September 5, 2020 (...) Patrick Connor 1 Quote Link to comment Share on other sites More sharing options...
v_kyr Posted September 5, 2020 Share Posted September 5, 2020 Well there are so many free reg expr test tools available (online and platform specific apps) and for whatever purpose. Just a few of them ... regex101 (online) regexr (online) Regulex (visualize reg expr) Debuggex (online) RegexPixie (Win) Rad Software Reg Expr Designer (Win .Net based) Expresso (Win .Net based) txt2re try it here ( uses a different approach and builds needed reg expr out of data strings for several prog languages) Regex Coach (Win) etc. See also: 30 useful reg expr tools & resources RegEx Knife (iPad/iPhone) etc. walt.farrell 1 Quote ☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan ☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2 Link to comment Share on other sites More sharing options...
walt.farrell Posted September 5, 2020 Share Posted September 5, 2020 2 hours ago, MikeW said: You were the person who brought up RegexBuddy and how it operates. My attempt was to get you to just press the reset button to demonstrate what RegexBuddy's default setting is futile. At least as regards admitting you were incorrectly representing how defaults in RegexBuddy work and that they comply to Boost's documentation. I brought up RegExBuddy only as an example of another program where when doing a case insensitive match, [[:lower:]] matches both upper- and lower-case letters, just as in Publisher. Earlier you (and the OP) seemed to be saying that Publisher was broken or had a bug because of that behavior when doing case insensitive matches. I was merely using RegExBuddy to demonstrate that Publisher's handling of [[:lower:]] matches several other programs, and so is (perhaps) a variant of proper behavior but not broken, per se. RegExBuddy's default for the Case Sensitive/Insensitive option doesn't matter for that discussion; what matters is how Case Insensitive works, when the user has chosen it. One unfortunate aspect of this, as @thomaso mentioned above, is the naming of the option in Publisher: 3 hours ago, thomaso said: From this perspective Affinity works correct but its UI is misleadingly confusing because it occurs vice versa, as if case sensitivity would be the extra option: if the option is ticked then case sensitivity is active. So, instead of offering an option called "Match Case" it could rather offer as a literally extra option "Don't match case", "Ignore case" or "Case insensitive". Another unfortunate aspect is that "Don't Match Case" is the default option (I've had time to create another user on my system and verify that). While that might be appropriate for non-regex searches, I would agree that it's backward for regex searches and gives unexpected results. 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...
MikeW Posted September 5, 2020 Share Posted September 5, 2020 Not talking to anyone in particular here. Just recording more of my thoughts for Serif to take into consideration... All major regex engines are case sensitive by default. Therefore I believe APub ought to have, as suggested in this thread, its engine changed to be case sensitive and change the switch to Match Case to be Case Insensitive AND to provide a Reset button on the Regex main screen so one doesn't need to vist a flyout just to see if that flag is set. Optionally, just use up some screen real estate and move the flyout options to the main screen and get rid of the flyout--but still make the default to be case sensitive. walt.farrell, Laganama and thomaso 3 Quote Link to comment Share on other sites More sharing options...
thomaso Posted September 5, 2020 Share Posted September 5, 2020 44 minutes ago, MikeW said: just use up some screen real estate and move the flyout options to the main screen and get rid of the flyout +1 !!! This flyout menu is indeed an unfriendly solution: Since it auto-closes with each single user selection it can force the user to open the menu several times before a search is ready to start, open it again and again, for each single option to tick or untick. – It would be very helpful to see the custom set search options at one view, perhaps in collapsible section(s) to save space. Or, at least, don't close the flyout until the user leaves it. MikeW 1 Quote macOS 10.14.6 | MacBookPro Retina 15" | Eizo 27" | Affinity V1 Link to comment Share on other sites More sharing options...
walt.farrell Posted September 5, 2020 Share Posted September 5, 2020 And that flyout has several options that are relevant to regex processing, located in two separate areas of the menu. Getting them all into one place, more easily visible in the Find panel, would be useful and provide a better UI. MikeW 1 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...
lacerto Posted September 6, 2020 Share Posted September 6, 2020 (...) MikeW 1 Quote Link to comment Share on other sites More sharing options...
Nin Posted December 26, 2021 Share Posted December 26, 2021 I know next to nothing about regex, but to find a word that is all caps in the imported text, I used [\A-Z+][\A-Z+][\A-Z+]. It shows examples of words that have 3 consecutive capital letters. I have to look at each and apply my Character Style of all caps before I change the body text in AP. Is there a better way to find words that are all in uppercase in the pre-formatted text? Quote Link to comment Share on other sites More sharing options...
v_kyr Posted December 26, 2021 Share Posted December 26, 2021 26 minutes ago, Nin said: Is there a better way to find words that are all in uppercase in the pre-formatted text? What about Words/Names which include numbers, like some company names etc. (aka 13APPS, SYSTEM_42)? [A-Z0-9_]+[A-Z0-9_]+ Quote ☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan ☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2 Link to comment Share on other sites More sharing options...
Laganama Posted December 30, 2021 Author Share Posted December 30, 2021 Hi there, according to https://www.regular-expressions.info/unicode.html#prop part "Unicode Categories" I start to use following strings to find "any lowercase" or "any uppercase": \p{Ll} \p{Lu} There are even more very useful strings to use too. Just have a try, which works in Afpub. Quote Affinity Suite 2.3.1 | iMac 5K (2017) 24GB, macOS Monterey 12.6.9 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.