hi,
how can i check for a word that has noncharaters in it,
as like sdf4df, 4rtrt, 909erter,

appreciate a reply,
thanks

i used

if (Regex.IsMatch(s.ToLower(), "[:lower:]"))
                                {}



                            it dosen't get rid of werwer343 words

When you use regular expressions, you must specify where it occurs in the string. To specify the whole string, you use \A at the beginning and \z at the end of the expression (case-sensitive). I had no idea [:lower:] would work in C#, however you can also use \w+ which matches any word character; then you wouln't have to use ToLower(). Note that regex character escapes are different than C# character escapes. For instance, you would either use:

"\\A\\w+\\z"

or

@"\A\w+\z"

since @ tells the compiler to ignore character escape sequences. See Regular Expression Language - Quick Reference for more info.

so \A is the beginning and the \z is match at the end. where do i specify that I want only to match alphabatical letter, because w+ is for 'any word charter' which includes number also
how do i specify from a-z from the beginning to the end and in the middle?

Did you read the link I gave you? You still need the +, as that means one or more, and nothing should come after the \z. Also, you can't have any spaces in there, since that's a literal.

Edited 4 Years Ago by nmaillet

This question has already been answered. Start a new discussion instead.