static int getNumberOfWords(String s) { final RegExp regExp = RegExp(r"[\w-._]+"); final Iterable matches = regExp.allMatches(s); return matches.length; }