简体   繁体   English

什么是正确的正则表达式以从jmeter正则表达式的html下面的href中提取ID

[英]What would be the correct Regular Expression to extract ID from href in below html for jmeter regular expression

My HTML code is: 我的HTML代码是:

<a class="view-details-ul-none" href="javascript:printCertificate('11673191')">

I try this expression: href="javascript:printCertificate(\\)|\\(.*?)"> it return me the ID but along id number it return brackets and comma too, like below image: 我尝试使用以下表达式: href="javascript:printCertificate(\\)|\\(.*?)">它返回给我ID,但沿ID号也返回括号和逗号,如下图所示:

When I pass this regular expression to next request as parameter my url become wrong and http send 500 http error code. 当我将此正则表达式作为参数传递给下一个请求时,我的网址变了,并且http发送了500个http错误代码。 because url looks like this: 因为url看起来像这样:

GET https://Domain/path/completionCertificate.pdf?Id=('11673191')

Could anyone please help me in this would be appreciated. 有人可以帮助我,对此将不胜感激。

Go for the following regular expression: 选择以下正则表达式:

<a class="view-details-ul-none" href="javascript:printCertificate\('(\d+)'\)">

Demo: 演示:

JMeter Regex演示

Remember to escape the following characters outside character classes: 请记住在字符类之外转义以下字符:

.^$*+?()[{\|

and these inside the character classes: 以及字符类中的这些:

^-]\

References: 参考文献:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM