Sorry first, im not good at Regex but anyone can help me ? i have file that named :
Filename - 01.exe
Filename - 001.exe
Filename - 0001.exe
Filename_01_.exe
I have tried with this Regex
(?=.*?)\d{1,4}\b
But that just detect 01, 001, 0001 number at Filename - 01.exe, Filename - 001.exe and Filename - 0001.exe, not worked with Filename_01_.exe Is my Regex is wrong or there Alternative Regex or Method ?
Sorry if my english is not well.
Since there is only one number in the file, how about simply using this:
\d+
In C#:
var myRegex = new Regex(@"\d+");
string resultString = myRegex.Match(yourString).Value;
Console.WriteLine(resultString);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With