C# Split streetname and number from address line

Date: 2024-01-30
private static readonly Regex AddressRegex = new Regex(@"^(.+?)\s+([0-9][ 0-9a-zA-Z\/-]*)\s*$");

public static (string street, string number) GetStreetNameAndNumber(string addressLine)
{
    var match = AddressRegex.Match(addressLine);
    if (!match.Success) return (addressLine, null);
    return (match.Groups[1].Value, match.Groups[2].Value);
}
82310cookie-checkC# Split streetname and number from address line