输入:
"//*[@id='headeritems1']": {
"type": "checkbox",
"value": "",
"selectorType": "xpath"
},
"//*[@id='headeritems3']": {
"type": "exitPopUp",
"value": "",
"selectorType": "xpath"
所需的输出:
"(//*[@id='headeritems1'])[2]": {
"type": "checkbox",
"value": "",
"selectorType": "xpath"
},
"(//*[@id='headeritems3'])[2]": {
"type": "exitPopUp",
"value": "",
"selectorType": "xpath"
如何捕获组中的数字标题项目1和3,而不是替换它们。
我使用的正则表达式:
sed -i "s/\/\/\*\[@id='headeritems[(\d)]'\]/\"(\/\/\*\[@id='headeritems\1'\])\[2\]/g"