validateStringPattern static method
Implementation
static bool validateStringPattern(String value, String pattern, {bool fullMatch = true}){
if(value.isNullOrEmpty() || pattern.isNullOrEmpty() || match(pattern, "any")){
return true;
}
print("NUIStringUtil -> Validating string pattern of $pattern");
var p = RegExp(pattern);
if(!fullMatch) {
final hasMatch = p.hasMatch(value);
print("NUIStringUtil -> Validating string pattern of $pattern returns hasMatch : $hasMatch");
return hasMatch;
}
else{
try {
final matches = p.allMatches(value);
for (Match match in matches) {
if (match.start == 0 && match.end == value.length) {
return true;
}
}
return false;
}catch(e){
return true;
}
}
}