as part of small program i'm writing need filter string input might "gibrish" (any sign in utf8) input can hebrew and/or english have normal signs : ?%$!@'_' , on...
a friend suggested use regex, due inexperience using come advice.
how can create c# function check input text , if it's not "right" return false
my try far is:
public static bool shorttest(string input) { string pattern = @"^[אבגדהוזחטיכלמנסעפצקרשתץףןםa-za-z0-9\_]+$"; regex regex = new regex(pattern); return regex.ismatch(input); }
all chars after "[" , "a" hebrew
for hebrew letters, in c# can somthing that:
return system.text.regularexpressions.regex.ismatch(value, @"^[א-ת]+$");
enjoy =)
Comments
Post a Comment