Count number of Takes or count number of occurences on a search term

Hi there

i use Scrivener currently to write audio dramas. These usually have a list of roles up front, such as
LUKE SKYWALKER (21): farmer, destined to save the galaxy
HAN SOLO (28): smuggler
etc.

Now in an audio drama all dialoge is organized in takes, similar to movie scripts:
324 - LUKE: She is amazing, who is she?
325 - OBI WAN: Forget her!

With the preceding list of chracters, i would like to include the number of takes this character has in the script at compile time, with a placeholder. Is that possible?
Or is it possible to count the number of occurences for a specific search term? With scrivener i already use counter placeholders for the takes such as
<$n:d> - EVA:
If it is possible to search for this term “<$n:d> - EVA:” and get the number of search results, that would also do the job, but i couldnt find any.

Where do you need this count to come? You can refer to the current number of a tagged auto-number. For instance, if you use <$n:d>, you could use <$n#d> to refer to the current number without incrementing it. You could therefore use this if your count comes at the end of the document.

All the best,
Keith

Hi Keith

this will not work, as i use one single placeholder for autonumbering ALL takes, like this: <$n:d>, So if there are 1000 take from different roles, the last number will be 1000. But i need the number of takes per individual role, such as Luke Skywalker: 341, Han Solo: 138, Chwebacca: 4 etc.

Best regards
Marc

My suggestion would be a new placeholder, one that counts the number of search results for any given regex statement, such as <$count:“regex”>
At compile time, the regex search would be executed and the number of occurrences would replace the tag.
With such a functionality, i could have one regex per role, such as <$count:“Luke:”>, <$count:“Han Solo:”> etc.