亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

獲取兩個字符之間的文本 JQuery

獲取兩個字符之間的文本 JQuery

慕村225694 2024-01-22 15:31:15
我想獲取兩個字符之間的所有文本示例<div class="text-center">                <a href="/Users/Users/EditUser?UserId={userId}" [email protected] 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?')" [email protected]>                    <span class="fa fa-trash-o fa-lg"></span>                </a>            </div>我有這個 html 變量,我需要括號“{}”之間的數組中的所有文本預期結果是:1.{用戶ID}2.{用戶角色}3.{用戶ID}在一個列表中。我嘗試過actualHtml.match(/\{(.*)\}/g)但結果是錯誤的,它采用第一個括號和最后一個括號,我得到的結果是 {userId}" [email protected] data-userRole="{userRole}
查看完整描述

1 回答

?
米脂

TA貢獻1836條經驗 獲得超3個贊

這是Talpar的回答

html.match(/\{([^}]+)\}/)就這樣


查看完整回答
反對 回復 2024-01-22
  • 1 回答
  • 0 關注
  • 171 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號