JonMny
asked on
Regex return only letters
how can I return only letters A-Z from a string using regex. if I have a string like "abcdef^&%0087" I only want . abcdef
C#
C#
string word ="";
word= myStr.Replace("[0-9](_&*?" , "");
word= myStr.Replace("[0-9](_&*?"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
i know you gave me the points already, but this is the perfected version:
using using System.Text.RegularExpress ions;
on my aspx page i have a text box - txt that the user inputs string to modify in...
you can just use strings in place of the text box...
basically says remove anything that is not alphabets - make everything else empty string - ""
txt.Text = Regex.Replace(txt.Text.ToS tring(), @"[^a-zA-Z]", "");
using using System.Text.RegularExpress
on my aspx page i have a text box - txt that the user inputs string to modify in...
you can just use strings in place of the text box...
basically says remove anything that is not alphabets - make everything else empty string - ""
txt.Text = Regex.Replace(txt.Text.ToS
cheers..
replace all other characters that aren't chars with ""...