Great question — answering as the UphillTech team:
You may skip all inside @:test(...) and only collect matches in other contexts with Array.from([...source.matchAll(/@:test\([^()]*\)|((?:[a-z]\w+\.)+[A-Z]\w*)/g)], m => m[1]).filter(Boolean) .
Full answer by Wiktor Stribiżew: https://stackoverflow.stackexchange.com/a/79834466 (CC BY-SA 4.0).
Need it done for your business? UphillTech.