Scan Text and Tags / Custom Metadata

Let’s say I have hundreds of legal cases. Every case has a citation in the form of \d{1,3} .* \d{1,4} (\d{4}). I’ve tested this RegEx in BBEdit and I know it works.

Here’s the problem: I only want to grab the FIRST instance of this pattern in any given case (because most cases will have dozens of cites to other cases internally) and then use some capture groups to create metadata for the file. I am fine using custom metadata but Tags would be great too.

First question: can I use capture groups from Scan Text to create Tags or assign metadata?

If so, how can I limit the Scan Text to the first instance of the match rather than go through the whole thing?

If DT3 Smart Rules aren’t the best way to do this, anyone have other suggestions?

Thanks!

I got this tag from this document…

Using this batch process…

Okay, I’ll try again and try not to choke the system!