Yes, this is why \{[^\}]+\}
is a clearer expression of intent. Inside the matched {}
we look for one or more (+
) characters that are not a closing brace. One or more not zero or more (*
) to avoid mis-matching a legitimate empty set of braces ({}
) as a citation marker. This approach is flexible at is doesn’t care where in the string the citations occur or if there is more than one per line (or tested string)
It may the edge case that (depending on the subject matter) that the subject matter has braces containing content. In that case, the braces alone are not a clear enough marker. If you have (and apply!) a very rigid format for the string describing the quote you could write a more complex regex to capture that structure. But, if {author, yyyy}
is the pattern and Prof. A. B. Clump has 3 papers published in 2001, you’ll be tweaking your regex. and so on for each edge case that breaks the existing one.
Simpler, if braces-with-content sequences are an insufficient marker, would be to place another marker either immediately before or after the citation. For instance, with an @
symbol using either of these:
{@ ... }
@{ ... }
Users of Markdown might need to take care as to the character chosen and its placement, so avoid sequences that signal (or no longer do) intent to the Markdown parser.
Even if using a complex export chain e.g. Tinderbox+Markdown → pandoc → Word, or such, do stop to consider is inserted extra markers can be deleted before or at export.
IOW, the constraint isn’t what it appears, but you can choose when (necessary) extra markers are needed. Also, there isn’t a button /menu option that ‘just’ does this, in no small part due to all the (unstated) assumptions in this process.