How comes this writes False?
Console.Write(Regex.IsMatch("[abcde]{1,16}", "babe"));
What's wrong with my regex? Doesn't that regex roughly translate to: contains between 1 and 16 characters, a through e?
How comes this writes False?
Console.Write(Regex.IsMatch("[abcde]{1,16}", "babe"));
What's wrong with my regex? Doesn't that regex roughly translate to: contains between 1 and 16 characters, a through e?
Your arguments are switched. I.e., use:
Regex.IsMatch("babe", "[abcde]{1,16}")
instead,
That's going to match any of the characters in "babe" that fall between a and e. So for example, "babez" would match as "babe". I get the sense you want treat it as a string match. Try:
[a-e]{1,16}$