简体   繁体   中英

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

My HTML code is:

<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:

When I pass this regular expression to next request as parameter my url become wrong and http send 500 http error code. because url looks like this:

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:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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