正则表达式提取HTML属性值

我有以下HTML

<tr><td class="width35pct alignR"><span style="font-weight: bold;">TO :</span></td><td class="width40pct alignC"><input id="form:firstTON" name="form:firstTON" type="text" value="114" maxlength="17" tabindex="7" style="width:198px; margin: 5px 0 5px 0;" class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all" /><script id="form:firstTON_s" type="text/javascript">//<![CDATA[PrimeFaces.cw('InputText','widget_form_firstTON',{id:'form:firstTON'});//]]><![CDATA[]]]]><![CDATA[></script></td><td class="alignl"><span style="font-weight: bold !important;" class="ar">number</span></td></tr>

而且我需要创建一个正则表达式来提取值“ 114”,这是“值”属性的值。

有什么帮助吗?

回答:

使用JMeter,使用

来完成此任务。

Reference Name: mynum

Regular Expression: value="(.+?)"

Template: $1$

Match No.: 1

如果使用指定Match No:,则规则如下:

0 = Random Match

1 = First Match

2 = Second Match

etc....

然后,您可以使用相应的变量来访问匹配项。 ${mynum_1}

以上是 正则表达式提取HTML属性值 的全部内容, 来源链接: utcz.com/qa/415048.html

回到顶部