How to extract id/numbers from the end of an URL using Javascript Regular Expressions (Regex)
I was working with the Zend Framework and flowplayer and I needed to extract the ID from the url.
Here is the short JavaScript snippet.
var extr_id_regex = new RegExp('(\\d+)$', "gi");
var url = '/a/b/c/123';
var id = url.match(extr_id_regex);
if (id) {
alert(id);
}
Related
Tags: flash, flowplayer, Javascript, js, match, regex, RegExp, Regular Expressions, Zend Framework, zf