xxxxxxxxxx
String mainString = "abc123";
print(mainString.contains(new RegExp(r'[a-z]')));
Answer:
The problem with your RegExp is that you allow it to match substrings,
and you match only a single character. You can force it to require that
the entire string be matched with ^ and $, and you can match against one
or more of the expression with +:
print(RegExp(r'^[a-z]+$').hasMatch(mainString));
To match all the characters you mentioned:
print(RegExp(r'^[A-Za-z0-9_.]+$').hasMatch(mainString));