Simple Regex Example in C#
c#Sometimes you just need a quick example of something you know how to do, but you can't remember the syntax for since you only need to use it from time to time.
using System;
using System.Text.RegularExpressions;
class Program
{
static void Main()
{
Regex rx = new(@":(\d+)-");
string text = "File:24524-abc.txt";
Match match = rx.Match(text);
if (match.Success)
{
Console.WriteLine(match.Groups[1].Value);
}
}
}