沿着(不要忘记Unicode正则表达式的“u”标志):
^(?:\*\*)?(?=[^*]{4,})(\p{Lu}+)(?:\s*-\s*(\p{Lu}+))?(?:\*\*)?\s*$
^ # start of line
(?:\*\*)? # two stars, optional
(?=[^*]{4,}) # followed by at least 4 non-star characters
(\p{Lu}+) # group 1, Unicode upper case letters
(?: # start no capture group
\s*-\s* # space*, dash, space*
(\p{Lu}+) # group 2, Inicode upper case letters
)? # end no capture group, make optional
(?:\*\*)? # two stars, optional
\s* # optional trailing spaces
$ # end of line
编辑:简化,根据评论:
^(?=[A-Z ]{4,})([A-Z ]+)(?:-([A-Z ]+))?\s*$
^ # start of line
(?=[A-Z -]{4,}) # followed by at least 4 upper case characters, spaces or dashes
([A-Z ]+) # group 1, upper case letters or space
(?: # start no capture group
- # a dash
([A-Z ]+) # group 2, upper case letters or space
)? # end no capture group, make optional
\s* # optional trailing spaces
$ # end of line
第1组和第2组的内容必须在使用前进行修剪。