import re

url = "www.mylocalurl.com/edit/1987"

num = re.sub('\D', '', url)

print(num)