# Standard Simple RegEx Expressions not working in Scrivner

**URL:** <https://forum.literatureandlatte.com/t/standard-simple-regex-expressions-not-working-in-scrivner/143378>\
**Category:** Scrivener for macOS\
**Tags:** feedback, searching\
**Created:** [October 9, 2024, 7:31pm UTC](https://forum.literatureandlatte.com/t/standard-simple-regex-expressions-not-working-in-scrivner/143378 "2024-10-09T19:31:57Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Randall\_Lee\_Reetz](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/randall_lee_reetz/32/156_2.png) [@Randall\_Lee\_Reetz](https://forum.literatureandlatte.com/u/Randall_Lee_Reetz)\
**Post date:** [October 9, 2024, 7:31pm UTC](https://forum.literatureandlatte.com/t/standard-simple-regex-expressions-not-working-in-scrivner/143378/1 "2024-10-09T19:31:57Z")

</div>

For instance, the expression…

\b[A-Z][a-zA-Z]\*\b

or

[A-Z][a-z]\*

… 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?

---

<div class="post-metadata">

**Author:** ![November\_Sierra](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/november_sierra/32/41086_2.png) [@November\_Sierra](https://forum.literatureandlatte.com/u/November_Sierra)\
**Post date:** [October 9, 2024, 7:38pm UTC](https://forum.literatureandlatte.com/t/standard-simple-regex-expressions-not-working-in-scrivner/143378/2 "2024-10-09T19:38:05Z")

</div>

Make sure to _uncheck_ “Ingnore Case”.

![ignore](https://forum.literatureandlatte.com/uploads/default/original/3X/5/9/59ec2b58c7a7b88aa9ae5d6cf46ad1d7baf6b3e6.png)

---

<div class="post-metadata">

**Author:** ![Randall\_Lee\_Reetz](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/randall_lee_reetz/32/156_2.png) [@Randall\_Lee\_Reetz](https://forum.literatureandlatte.com/u/Randall_Lee_Reetz)\
**Post date:** [October 10, 2024, 6:38pm UTC](https://forum.literatureandlatte.com/t/standard-simple-regex-expressions-not-working-in-scrivner/143378/3 "2024-10-10T18:38:56Z")

</div>

Where is this “Find Options” panel? I don’t see it in Settings or Project Settings. I don’t see it in any menu.

---

<div class="post-metadata">

**Author:** ![November\_Sierra](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/november_sierra/32/41086_2.png) [@November\_Sierra](https://forum.literatureandlatte.com/u/November_Sierra)\
**Post date:** [October 10, 2024, 6:58pm UTC](https://forum.literatureandlatte.com/t/standard-simple-regex-expressions-not-working-in-scrivner/143378/4 "2024-10-10T18:58:20Z")

</div>

In the search dialog:

 ![search](https://forum.literatureandlatte.com/uploads/default/original/3X/e/7/e70863f93c0a95d5c03e312cf351d68777514968.png)

---

<div class="post-metadata">

**Author:** ![MimeticMouton](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/mimeticmouton/32/34_2.png) [@MimeticMouton](https://forum.literatureandlatte.com/u/MimeticMouton)\
**Post date:** [October 10, 2024, 11:43pm UTC](https://forum.literatureandlatte.com/t/standard-simple-regex-expressions-not-working-in-scrivner/143378/5 "2024-10-10T23:43:43Z")

</div>

If you’re using project search, be sure that “Case Sensitive” is selected in the bottom “Options” section of the search magnifying glass menu.

---

<div class="post-metadata">

**Author:** ![Randall\_Lee\_Reetz](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/randall_lee_reetz/32/156_2.png) [@Randall\_Lee\_Reetz](https://forum.literatureandlatte.com/u/Randall_Lee_Reetz)\
**Post date:** [October 11, 2024, 12:59am UTC](https://forum.literatureandlatte.com/t/standard-simple-regex-expressions-not-working-in-scrivner/143378/6 "2024-10-11T00:59:57Z")

</div>

The RegEx: \b[A-Z][a-z]+(?:\s[A-Z].)?(?:\s[A-Z][a-z]+)+\b yields…

 ![Screenshot 2024-10-10 at 5.50.11 PM](https://forum.literatureandlatte.com/uploads/default/original/3X/2/2/22635ff8d9921e59435a9bb2246e2df866bb2381.png)

… in [RegEx.com](http://RegEx.com)’s test, but yeields…

 ![Screenshot 2024-10-10 at 5.51.56 PM](https://forum.literatureandlatte.com/uploads/default/original/3X/8/5/8525ef92df58c261a5013ba3cbf1b6d51343b913.jpeg)

… 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.

Thanks, Randall

---

<div class="post-metadata">

**Author:** ![November\_Sierra](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/november_sierra/32/41086_2.png) [@November\_Sierra](https://forum.literatureandlatte.com/u/November_Sierra)\
**Post date:** [October 11, 2024, 1:11am UTC](https://forum.literatureandlatte.com/t/standard-simple-regex-expressions-not-working-in-scrivner/143378/7 "2024-10-11T01:11:51Z")

</div>

![regexoptions](https://forum.literatureandlatte.com/uploads/default/original/3X/b/d/bd3cd2472847d7d877bd27a09ce30fda2ed92472.png)

---

<div class="post-metadata">

**Author:** ![Randall\_Lee\_Reetz](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/randall_lee_reetz/32/156_2.png) [@Randall\_Lee\_Reetz](https://forum.literatureandlatte.com/u/Randall_Lee_Reetz)\
**Post date:** [October 11, 2024, 1:20am UTC](https://forum.literatureandlatte.com/t/standard-simple-regex-expressions-not-working-in-scrivner/143378/8 "2024-10-11T01:20:17Z")

</div>

Not working here, are you one a Mac or PC?

---

<div class="post-metadata">

**Author:** ![November\_Sierra](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/november_sierra/32/41086_2.png) [@November\_Sierra](https://forum.literatureandlatte.com/u/November_Sierra)\
**Post date:** [October 11, 2024, 1:20am UTC](https://forum.literatureandlatte.com/t/standard-simple-regex-expressions-not-working-in-scrivner/143378/9 "2024-10-11T01:20:35Z")

</div>

Scrivener 3.3.6 (16305) on macOS 15.0.1 (24A348)

---

<div class="post-metadata">

**Author:** ![Randall\_Lee\_Reetz](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/randall_lee_reetz/32/156_2.png) [@Randall\_Lee\_Reetz](https://forum.literatureandlatte.com/u/Randall_Lee_Reetz)\
**Post date:** [October 11, 2024, 1:24am UTC](https://forum.literatureandlatte.com/t/standard-simple-regex-expressions-not-working-in-scrivner/143378/10 "2024-10-11T01:24:44Z")

</div>

Question: Why would one have to tell Scrivener to (or not to) pay attention to case, if case is being overtly specified in a Regular Expression?

---

<div class="post-metadata">

**Author:** ![November\_Sierra](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/november_sierra/32/41086_2.png) [@November\_Sierra](https://forum.literatureandlatte.com/u/November_Sierra)\
**Post date:** [October 11, 2024, 1:35am UTC](https://forum.literatureandlatte.com/t/standard-simple-regex-expressions-not-working-in-scrivner/143378/11 "2024-10-11T01:35:29Z")

</div>

That’s for the devs to answer, I don’t know.

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.)

---

<div class="post-metadata">

**Author:** ![nontroppo](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/nontroppo/32/15746_2.png) [@nontroppo](https://forum.literatureandlatte.com/u/nontroppo)\
**Post date:** [October 11, 2024, 3:20am UTC](https://forum.literatureandlatte.com/t/standard-simple-regex-expressions-not-working-in-scrivner/143378/12 "2024-10-11T03:20:51Z")

</div>

> [@Randall\_Lee\_Reetz](#):
>
> Question: Why would one have to tell Scrivener to (or not to) pay attention to case, if case is being overtly specified in a Regular Expression?

How could you run a case insensitive search if you don’t have a switch? This is how regex fundamentally works across all engines: [What are regex modifiers, and how to turn them on?](https://www.rexegg.com/regex-modifiers.php#i) and [Regular Expressions | ICU Documentation](https://unicode-org.github.io/icu/userguide/strings/regexp.html#case-insensitive-matching)

**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](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:

> **[Regular Expressions](https://unicode-org.github.io/icu/userguide/strings/regexp.html)**
>
> ICU is a mature, widely used set of C/C++ and Java libraries providing Unicode and Globalization support for software applications. The ICU User Guide provides documentation on how to use ICU.

Remember: with great power comes great responsibility… 🤓

---

<div class="post-metadata">

**Author:** ![nontroppo](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/nontroppo/32/15746_2.png) [@nontroppo](https://forum.literatureandlatte.com/u/nontroppo)\
**Post date:** [October 11, 2024, 4:17am UTC](https://forum.literatureandlatte.com/t/standard-simple-regex-expressions-not-working-in-scrivner/143378/13 "2024-10-11T04:17:41Z")

</div>

> [@Randall\_Lee\_Reetz](#):
>
> 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.

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\>

---

<div class="post-metadata">

**Author:** ![auxbuss](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/auxbuss/32/115_2.png) [@auxbuss](https://forum.literatureandlatte.com/u/auxbuss)\
**Post date:** [October 11, 2024, 7:58am UTC](https://forum.literatureandlatte.com/t/standard-simple-regex-expressions-not-working-in-scrivner/143378/14 "2024-10-11T07:58:56Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![November\_Sierra](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/november_sierra/32/41086_2.png) [@November\_Sierra](https://forum.literatureandlatte.com/u/November_Sierra)\
**Post date:** [October 11, 2024, 6:02pm UTC](https://forum.literatureandlatte.com/t/standard-simple-regex-expressions-not-working-in-scrivner/143378/15 "2024-10-11T18:02:21Z")

</div>

@Randall_Lee_Reetz So, to expand on the replies of @nontroppo and @auxbuss, we started here with your original pattern:

`\b[A-Z][a-z]+(?:\s[A-Z].)?(?:\s[A-Z][a-z]+)+\b`

 ![1](https://forum.literatureandlatte.com/uploads/default/original/3X/a/7/a799b76a37b3f2aa4ec14a07ba618b74a5c2ff0a.jpeg)

Doesn’t work, unless you enable the “Case Sensitive” option:

 ![2](https://forum.literatureandlatte.com/uploads/default/original/3X/a/6/a6c18afbc30ae450da2ff6c1b70c367e59741add.jpeg)

But you’re not limited to this approach. You can also just use the pattern:

`(?-i)\b[A-Z][a-z]+(?:\s[A-Z].)?(?:\s[A-Z][a-z]+)+\b`

(notice the `(?-i)` at the beginning) and then the menu option makes no difference at all:

 ![3](https://forum.literatureandlatte.com/uploads/default/original/3X/b/c/bcfd7d421637d60a4fda92f96a1f20a5eeda4c95.jpeg)

 ![4](https://forum.literatureandlatte.com/uploads/default/original/3X/8/3/832573f4348931a70aff6d1efd4c59725e9a546d.jpeg)
