Logout
That above is what I want to search for.
I want to get h= and t= from that URL, or just get the entire url in href=""
How would I do this with regex?
Logout
That above is what I want to search for.
I want to get h= and t= from that URL, or just get the entire url in href=""
How would I do this with regex?
You should be able to get the href
with:
var array_of_matches = str.match(/href="([^"]*")/g)
Look for 'href="' then start a capture group of all non-double-quote characters, until it ends with a final doublequote. You can pull out the query arguments using more groups inside that group.
Look at this javascript regex tutorial. And the global flag to get the array of matches described in the string regex api.
This should return both h
and t
values:
logout.php\?h=(\w+)&t=(\w+)
/href="[^"]+"/g