Regex Number String

CSharp · Console

/Program.cs

using System;
using System.Text.RegularExpressions;
					
public class Program
{
	public static void Main()
	{
		string nome = "63659 MARIA APARECIDA DE SOUZA MOURA 636459";

            var novoTexto = Regex.Match(nome, @"\d+$").Value;

            if(novoTexto.Length > 4)
                nome = nome.Replace(novoTexto,"");
		
		Console.Write(nome);

	}
}
;