大括号之间获取文本{text}

时间:2018-10-13 14:56:39

标签: javascript regex

我有一个类似

的文字
It's a beatiful {day|morning|{month|year}} and I {watch {a serie| a movie}|play games}

我想得到

day|morning|{month|year}

watch {a serie| a movie}|play games

从此文本。

当前,我有一个使用/\{(.+?)\}/g的正则表达式,但是当方括号内有方括号时,它不起作用。这是我目前拥有的一个示例:https://www.regextester.com/?fam=105404

如您所见,{day|morning|{month|year}}不能完全选择,因为有嵌套的花括号。我该如何解决?

0 个答案:

没有答案
相关问题