【发布时间】:2015-08-09 14:33:54
【问题描述】:
我正在尝试使用正则表达式获取大括号内的子字符串。
假设我有以下字符串:
"This is a {nice} text to search for a {cool} substring".
我希望能够搜索nice 和cool
【问题讨论】:
-
\{([^}]*)\},问了很多次。或string.match(/[^{}]*(?=\})/g) -
@AvinashRaj 大声笑太累了无法发布答案?? :-)
标签: javascript regex substring