parseDomainPattern static method
Parses a domain pattern.
- If is in the format
r/.../
it will be parsed as a RegExp. Example:r/(www\.)?mydomain.com/
- See APIServer.domainsRoots.
Implementation
static Pattern parseDomainPattern(Pattern domainPatter) {
if (domainPatter is RegExp) return domainPatter;
var s = domainPatter.toString().trim();
if (s.startsWith('r/') && s.endsWith('/')) {
var re = s.substring(2, s.length - 1);
return RegExp(re);
}
if (s == '*' || s == '.') {
return RegExp(r'.*');
}
return s;
}