Hi i need to check the string contains the numeric values at end of the string like the string is “XXXXXXXX@GMAIL.COM00” after the .com i want to check is there any numeric is there are not any thing is there after the .com i want to remove please kiendly help to get it
Hi @chandolusathi.kumar ,
Could you Check with the below Regex Expression :
\d+$
Expression to use for Replacement :
System.Text.RegularExpressions.Regex.Replace("XXXXXXXX@GMAIL.COM00","\d+$","")
Let us know if it doesn’t work.
Check this option as well
Regex.Replace("XXXXXXXX@GMAIL.COM00", "\d+$", string.Empty, RegexOptions.None )
Hi @supermanPunch it is not only the numric value after the .com i want to remove whatever it kindly help me on this
For this we would need to understand exactly what inputs will you be receiving, is it only .com
emails ? or would you have different top level domains present ?
it is like “XXXXXXXX@GMAIL.COM0o” or “XXXXXXXX@GMAIL.COM00” or “XXXXXXXX@GMAIL.COM0*”
so any kind of thing after the .com i want to check if is there anything is present after the .com and if exists i want to remove
it is like “XXXXXXXX@GMAIL.COM0o” or “XXXXXXXX@GMAIL.COM00” or “XXXXXXXX@GMAIL.COM0*”
so any kind of thing after the .com i want to check if is there anything is present after the .com and if exists i want to remove
Could you maybe try using the below regex Expression :
(?<=\.com).*
System.Text.RegularExpressions.Regex.Replace("XXXXXXXX@GMAIL.COM00","(?<=\.com).*","")
Let us know if it doesn’t work.
Try this
"XXXXXXXX@GMAIL.COM0o".Substring(0, "XXXXXXXX@GMAIL.COM0o".LastIndexOf(".COM") + ".COM".Length)