using System;
using System.Text.RegularExpressions;
public class Program
{
public static void Main()
var re = new Regex(@"/(\d+)(?=-)");
var match = re.Match("http://www.meudominio.com/1789519-texto");
Console.WriteLine(match.Groups[1]);
}