… should find all words begining in a capital letter. But it instead seems to be finding all sorts of word strings, some of which do and most of which don’t match the indicated pattern. I’ve tested this expression in other environments that support RegEx. Works everywhere else. What am I doing wrong? Is RegEx broken in Scrivener on Mac?
… in Scrivener. Anyone know why? This isn’t fixed, as some have suggested, by setting scrivener’s search preferences to “Ignore Case” (or not). If anyone can tell me how to make RegEx work in Scrivener I would vary much appreaciate it. If indeed as it seems (I have tried a great many RegEx expressions in Scrivener and very few have worked as expected), is wonky and doesn’t really work, it would be nice to know that as well.
What I know is: If my pattern says “find every dog” and there’s an option “Ignore Dogs”, I would turn that option off. (Or “Include All Animals” on, if it otherwise excludes dogs for some reason.)
Note: there are many subtle differences between flavours of regex, just because an online regex engine says A it does not mean that is how regex works or that another engine is wrong. The Scrivener manual specifies the regex engine macOS Scrivener uses is ICU:
Scrivener uses the stock RegEx engine supplied by the Mac, which uses the UTF-8 compatible ICU guidelines. ICU is mostly compatible with PCRE, which is considered to be the standard for extended regular expression syntax. — §11.7 page 285
I prefer to use https://regex101.com in PCRE mode as it should match similarly for testing and learning, but that doesn’t guarantee identical matching so you may need to get into the weeds:
Remember: with great power comes great responsibility…
Maybe I got out of bed on the wrong side this morning, but your assumption here irks me. Regex is a complex tool, and you obviously are fairly naive as you don’t even know about case insensitivity flags, yet you feel (“as it seems”) you know more than the ICU engine, Apple or the Scrivener developer. Humility in face of limited knowledge is always to right path to take… <rant-mode off>
fwiw, I use regex exclusively. I have Case Sensitive unchecked and add (?-i) to my query when I require it to be case sensitive. Works 100% of the time. I do hundreds of queries a day.
(I have a keyboard replacement set for (?-i) to make things easier.)