JQuery How to extract value from href tag

jquery

I am new to JQuery.

If I have the following tag. What is the best JQuery method
to extract the value for "page" from the href.

<a href="Search/Advanced?page=2">2</a>

Malcolm

Best Answer

The first thing that comes to my mind is a one-liner regex:

var pageNum = $("#specificLink").attr("href").match(/page=([0-9]+)/)[1];