I am currently working on a process with a lot of string manipulation. I need to get three dates from a string that will be in a consistent order, but the rest of the data positions are inconsistent. I’d like to remove all characters from a string that isn’t a date in the format “dd/MM/yyyy”.
Example string: 20/10/2020 6741002 1042687,William Coulson, ISP, From 20280935 6,364.24 12/10/2020 - To 08/11/2020, ‘Service Level Example string - (Forum Specific) (Placement)’, SPOT,
I have got a Regex for removing the date, but I need it the other way round. System.Text.RegularExpressions.Regex.Replace(Filename,"[\d/]","")
Has anybody done this before for similar instances? Or can help me with the above instance?
@prasath17,
I am aware of the fact that the regex pattern I supplied is the opposite of what I wanted. Hence why I said so. Thought it may have helped to point out the pattern supplied is not what I wanted…
As @Pravin_Patil1 responded first and I tried his solution first, I marked his as the solution. I can confirm yours works too, as I tried that after I tried @Pravin_Patil1’s solution and marked it as the solution. Thank you for your time