Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
TryBot regex
<?php
$arrRegexPatterns = array(
'subreddit' => "/(reddit\.com|reddittryhard\.com)?(?:\/r\/){1}([\w]+)/i",
);
if (preg_match($arrRegexPatterns['subreddit'], $text, $arrMatches) !== false)
{
echo json_encode($arrMatches);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment