From the following markup.
Somewhere Somewher
var id = $(this).attr('id'), regex = /(\d+)/, matched = id.match( regex ); if ( matched ) { alert( matched[1] ) }