Based on the string "Plane Liberty Company +50 - 043-98965-2784 (058 / POS / SMP)", I need to get the part of "043-98965-2784".
I noticed that in the txt file I'm using, the numbers follow the pattern "000-00000-0000".
Could anyone help me?
Based on the string "Plane Liberty Company +50 - 043-98965-2784 (058 / POS / SMP)", I need to get the part of "043-98965-2784".
I noticed that in the txt file I'm using, the numbers follow the pattern "000-00000-0000".
Could anyone help me?
Would that be
var match = Regex.Match(str, @"(\d{3}-\d{5}-\d{4})");
The \d
captures any digit, the number in braces tells the number of digits to be captured and the stroke is a literal, ie, it captures a stroke.
Complete code:
using static System.Console;
using System.Text.RegularExpressions;
public class Program
{
public static void Main()
{
var str = "Plano Liberty Empresa +50 - 043-98965-2784(058/PÓS/SMP)";
Match match = Regex.Match(str, @"(\d{3}-\d{5}-\d{4})");
Write(match.Groups[1].Value);
}
}