How to Find Empty Metadata Fields in Scrivener using RegEx

Loading

person looking at camera through magnifying glass

This article contains affiliate links, meaning we’ll earn a small commission if you purchase products through these links.

I love using regular expressions in Scrivener to search for information throughout my manuscript, whether I’m looking for an overused word or just trying to find how many times a certain character shows up. But the other day, I wanted to find all the documents where I had omitted keywords. Here’s a quick post to share what I found.

I went to the Internet to search for finding fields with null or empty values using regular expressions. After multiple Internet searches and several articles that didn’t really answer my question, I went back to Scrivener to see what I could figure out by playing with it.

And lo-and-behold, I found the Invert Results feature! It basically says find everything that DOES NOT match the current Search criteria.

Example:

In this example, I want to identify scenes (documents) where I haven’t assigned Keywords. (For a refresher on how regular expressions work, see the related article Using Regular Expressions.)

  1. Click the drop-down field just to the left of the Search field. (It looks like a magnifying glass with a drop-down symbol.) Then select Keywords, RegEx, Search Manuscript Only, and Case Sensitive. You should see a list of all items in your Manuscript.
  2. In Scrivener, in the Search bar at the top of your binder, type in the following code to find everything: ^*$
  3. Now click the search dropdown again and select Inverse Results near the bottom. Everything that already contained Keywords disappears from the list.

You can use this same method to find Label, Status, and other metadata fields are empty.


Happy Writing!

This Post Has 2 Comments

  1. Ed Skinner

    In the good old days, I learned “grep -v” for the same effect but in several years of Scrivener, I never looked that far down the search menu. Thanks for pointing out the invert option. (Found two of ninety-odd scenes with no keywords!)

    1. Lancy McCall

      That’s awesome, Ed! I’m always shocked when I find glaringly obvious things that I’ve omitted.

      Glad I could help.

Leave a Reply