I want to check if a string only contains:
- Letters
- Numbers
- Underscores
- Periods
in Flutter, I tried the following to get only the letters but even if other characters are there it returns true if it contains a letter:
String mainString = "abc123";
print(mainString.contains(new RegExp(r'[a-z]')));
As I told it returns true since it contains letters, but I want to know if it only contains letters.
Is there a way to do that?