channelMatches static method
Check if a channel matches a pattern
Implementation
static bool channelMatches(String channel, String pattern) {
if (!isValidChannelName(channel) || !isValidChannelPattern(pattern)) {
return false;
}
// Convert pattern to regex
final regexPattern = pattern
.replaceAll('**', '.*') // ** matches any number of segments
.replaceAll('*', '[^/]*'); // * matches any characters except /
final regex = RegExp('^$regexPattern\$');
return regex.hasMatch(channel);
}