INPUT : There's string that numbers, and a string, dots and spaces. Notice that e defines a the separator between the numbers.
e.27.3.90.. .e 3.50 2.30..e2.0.1.2. .50..
OUTPUT : I want to remove all the spaces and those extra dots except for the one that makes up following and add a , before e,
,e273.90,e3502.30,e2012.50
Best catch was this How to remove extra decimal points?. But it's based on
JavascriptparseFloat().I also saw this post : Convert to valid decimal data type. But that's in terms of
SQLand pretty much using multiplereplace().
PS: There are so many posts regarding regex in various kind. I tried to build one, but seems like no success so far.
- Please propose any efficient one shot
regexor ideas. - Would like to hear the performance gain/loss of this
regexvs multiplereplace()
Here is the code I have been gasping ;)..:
List<string> myList;
string s = "";
string s2 = "";
string str = "e.27.3.90..bl% .e 3.50 2.30. #rp.e2.0.1.2..50..y*x";
s = Regex.Replace(str, @"\b[a-df-z',\s]+", "");
myList = new List<string>(Regex.Split(s, @"[e]"));