正则表达式匹配大括号中的多个单词,下划线 separated/delimited,但忽略字符串 Start/End 处的字符?

Regex to match Multiple words enclosed in Braces, separated/delimited by Underscore, BUT ignoring characters at Start/End of String?

我只是想获得一个匹配以下值的 Regex 表达式:

{{word1}}_{{word2}}_{{word3}}      // MATCH
_{{word1}}_{{word2}}_{{word3}}.    // NO MATCH
{{word1}}_word{{word2}}_{{word3}}  // NO MATCH
{{word1}}_{{word2}}_{{word3}}word4 // NO MATCH
{{word1}}_{{word2}}_{{word3}}_     // NO MATCH
_{{word1}}_{{word2}}_{{word3}}_    // NO MATCH
{{word1}}_{{word2))_{{word3}}      // NO MATCH
+{{word1}}-{{word2}}_{{word3}      // NO MATCH

基本上,该模式是两个大括号({{ 和 }})包围一些单词 (\w+),由下划线 (_) 分隔或分隔。字符串开头或结尾不应有任何字符。

我遇到的问题是我的正则表达式,它将匹配存在于字符串之外的值,例如,这就是我当前使用的:

\b({{\w+}})(\b_\b)*

所以它将 word{{word}}_{{word2}}_ 的字符串并使它们有效

^{{\w+}}(?:_{{\w+}})*$

解释

^ asserts position at start of a line
{{ matches the characters {{ literally (case sensitive)
\w matches any word character (equivalent to [a-zA-Z0-9_])
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
}} matches the characters }} literally (case sensitive)
Non-capturing group (?:_{{\w+}})*
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
_{{ matches the characters _{{ literally (case sensitive)
\w matches any word character (equivalent to [a-zA-Z0-9_])
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
}} matches the characters }} literally (case sensitive)
$ asserts position at the end of a line

https://regex101.com/r/UJ0GdY/2