The response body has the following html code.
href="/actions/Catalog.action?viewProduct=&productId=K9-PO-02"
I want to get the ProductId value
So I need to extract the response body
check(regex("""href="/actions/Catalog.action?viewProduct=&productId=(.+?)">"""))
However, I get a error
> regex(href="/actions/Catalog.action?viewProduct=&productId 1 (100,0%)
=(.+?)">).find.exists, found nothing
How I can solve this?
Thank you
Hello
Can you pls try escaping the forward slash(/), dot(.) and que(?) like below?
href="\/actions\/Catalog\.action\?viewProduct=&productId=(.+?)"
you can use https://regex101.com/ this website to validate your regex
Thanks, I thought the triple quotes were enough to scape the special characteres.
Triple quotes only save you from Java String escaping (inner double quotes and backslashes), not regex special characters escaping.