这是我要搜索的字符串。
Make {The Most|One of the most} Out Of Your {Real Estate|Realty|Property} {Purchase|Acquisition} When You {Follow|Comply With|Adhere To} { something } These Tips
Run Code Online (Sandbox Code Playgroud)
它应该搜索并返回花括号中的字符串部分,{ }并且其中必须包含一个或多个管道|符号。
以下是我想出的正则表达式,但它不起作用。
/^{?([^{]*\|)*}$
Run Code Online (Sandbox Code Playgroud)
预期产出
[{The Most|One of the most}, {Real Estate|Realty|Property}, {Real Estate|Realty|Property}, {Purchase|Acquisition}, {Follow|Comply With|Adhere To}]
Run Code Online (Sandbox Code Playgroud)
请注意,它{ something }不应该是输出的一部分。提前致谢