OK, so I'm working with a little regular expression—it's my first time, please, be gentle—and I've run into a problem where I can set a variable with it but if I try to do anything with that variable it causes problems.
Here's my script:
$(document).ready(function () {
var show_number;
var url_param;
$("a[rel=more]").live("click", function(){
url_param = $(this).attr("href").match(/show:[^/]+/i);
show_number = url_param.substr(5);
alert(show_number);
return false;
});
});
Now instead of showing the alert the way it should it just follows the link. However, if I get rid of the "show_number" variable and set it to alert the "url_param" everything goes fine.
I basically need to get what comes after the first five characters of that RegEx. I tried adding the substr() function directly to it but that didn't seem to help.
What am I doing wrong?