package DDG::Spice::RedditSubSearch;
# ABSTRACT: Search for subreddits

use strict;
use DDG::Spice;

triggers query_lc => qr#^(?:subreddit|/r/)\s*(?<match>\w+)$|^(?<match>\w+)\s+subreddit$#i;

spice to => 'http://www.reddit.com/r/$1/about.json?jsonp=ddg_spice_reddit';

handle query_lc => sub {
    return $+{match};
};

1;

package DDG::Spice::RedditSubSearch;
# ABSTRACT: Search for subreddits

use strict;
use DDG::Spice;

triggers startend => 'subreddit', '/r/';

spice to => 'http://www.reddit.com/r/$1/about.json?jsonp=ddg_spice_reddit';

handle query_lc => sub {
    return unless $_ =~ qr#^(?:subreddit|/?r/?)\s*(?<match>\w+)$|^(?<match>\w+)\s+subreddit$#i;
    return $+{match};
};

1;

Revert "Migrate to regex triggers"
Revert "Migrate to regex triggers"

This reverts commit 8fb8db8f3bf6cbca9eccb395df6d97eafed80b1a.
