用于提取 HTML 属性值的正则表达式

regex to extract HTML attribute value

我有以下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”,这是 "value" 属性的值。

有什么帮助吗?

使用JMeter,使用Regular Expression Extractor来完成这个任务。

Reference Name: mynum
Regular Expression: value="(.+?)"
Template: $
Match No.: 1

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

0 = Random Match
1 = First Match 
2 = Second Match
etc....

然后就可以使用对应的变量来访问匹配了。 ${mynum_1}