I have many strings in this format:
fdg.sdfg.234fdsa.dsf_1.2.5.62.xml
23432ssdfsa_sadfsd_1.2.7.6.xml
3.3.3asdf_ddd_1.2.1.doc
I would like to get only the number
from: fdg.sdfg.234fdsa.dsf_1.2.5.62.xml to get: 1.2.5.62
from: f23432ssdfsa_sadfsd_1.2.7.6.xml to get: 1.2.7.6
from: f3.3.3asdf_ddd_1.2.1.doc to get: 1.2.1
etc
This code works:
string test = "4534534ghgggg_1.1.3.4.xml";
int to = test.LastIndexOf('.');
int from = test.LastIndexOf('_') + 1;
Console.WriteLine(test.Substring(from,to - from));
But I want to know how can I do it with regex. Any ideas?
