var str = "/infocentr/50375/text_bm/zagolovok_dannoi_zametki.47238", num = str.match(/(?:infocentr\/)(\d+)/)[1]; alert(num);