I would like to know how I use the regex in Jmeter to capture tokens from HTML. I have created a regex but it's not getting what I required.
My HTML code with the token is :
<html><head></head><body><script type="text/javascript"> fetch("../../cookie", { method: "POST", mode: "cors", cache: "no-cache", credentials: "include", headers: { "Content-Type": "application/json", }, redirect: "follow", referrerPolicy: "no-referrer", body: JSON.stringify({ token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzeXN0ZW1pZCI6Im5pcnZhbmEtZGlyZWN0LW5hLXFhMyIsInBpZCI6IjE2NTgwMzQ5MjE4NjgtMUpyM3hhdHNHNElvQkgxNHBWOXZhNiIsImxhdW5jaGlkIjoiNExSRXBBUFFJMkFPN3ZwbUFwazd1MiIsImlhdCI6MTY1ODAzNDkyMywiZXhwIjoxNjU4MDM0OTgzLCJpc3MiOiJQU0kifQ.DjYRQHoPeax9toiE0aC0l2af4DZbSwLNuySrnytDq-I" }), }).then((response) => { if (!response.ok) throw new Error(response.statusText); document.location.href = "../../../index.html"; }).catch((error) => { console.log(`error: ${error}`); });</script></body></html>
In need to extract the value in between double quotes of token.
The tried regex is : token: "[^"]*
I won't require token text in this.