我想获取两个字符之间的所有文本示例
<div class="text-center">
<a href="/Users/Users/EditUser?UserId={userId}" title=@Resource.EditTlp data-userRole="{userRole}">
<span class="fa fa-pencil fa-fw"></span>
</a>
<a href="/Users/Users/DeleteUser?UserId={userId}" onclick="return confirm('Are you sure you want to delete this?')" title=@Resource.DeleteTlp>
<span class="fa fa-trash-o fa-lg"></span>
</a>
</div>
我在一个变量中有这个html,我需要括号之间的数组中的所有文本"{}">
预期结果是:
1.{userId}
2.{userRole}
3.{userId}
在列表中。我试过使用actualHtml.match(/{(.*)}/g)
但是取第一个括号和最后一个括号的结果是错误的我得到的结果是{userId}" title=@Resource.EditTlp data-userRole="{userRole}
以下是Talpar的答案
html.match(/{([^}]+)}/)
这都是