.net - Easiest way to extract 4 digit number out of string? -
if know string going like:
abc xyz 5678
or
qweroi yreoiu 4679
what best way extract last 4 digit string?
in c# whole thing
string mystring = "qweroi yreoiu 4679"; regex regex = new regex(@"\d{4}$"); match result = regex.match(mystring);
you can use .tostring() if need keep working match. additional information regex recommend this article.
Comments
Post a Comment