I have a string where i want to replace some chars by empty chars inside a string.
For eg my string is :
"<anyKey>2018-10-08T00.00000-07:00</anyKey>"
The regex i use is :
return System.Text.RegularExpressions.Regex.Replace(sb.ToString(), "<{1}[0-9a-zA-Z]*Key>{1}[0-9]{4}-[0-9]{2}-[0-9]{2}(?<timeandzone>T[0-9]{2}.[0-9]{5}-[0-9]{2}:[0-9]{2})</{1}[0-9a-zA-Z]*Key>{1}", "");
So the output i get is empty. It means that my regex is correct and it is replacing it with empty string, but i just want output like :
"<anyKey>2018-10-08</anyKey>"
I just want to find something that starts with "T" inside the tag where "Key" word is there and replace it with "".
Can you tell me what should i change here ?
Update : I have an XML which is 1000 lines, but it is stored in a String, so in some cases i need to replace this thing.