Reputation: 2866
I need to grab the ##
index/##/
"##" denotes numeric value.
I'm planning to run the regex is javascript.
Upvotes: 0
Views: 150
Reputation: 1066
You can use the \/
to escape slashes you want to use in your regular expressions:
So the result would be:
var input = "http://example.com/...../post/index/88/mike-hey-dddd";
var match = input.match(/\/index\/(\d+)/i);
// Make sure to validate the result, as it might not
// match for a given alternative url.
var number = match ? match[1] : false;
alert(number);
Upvotes: 1