...Technology Simplified

Friday, April 20, 2012

ASP.Net/C# - Regex Expression

No comments :
var rx = new Regex(@"[^_]+$");
var tests = new string[]
{
"bym338x2101_aev_bk/lasa/a/230862_15",
"bym338x2101_aev_bk/lasa/a/230862_1",
"bym338x2101_aev_bk/lasa/a/230862_103"
};

foreach (var test in tests)
{
Console.WriteLine( rx.Match(test).Value );
}

/* Output

15
1
103

*/

No comments :

Post a Comment