how to figure out this regex? %r{^/(?:(?!help|pages))} the beginning of the line, a forward slash not follwed by help or pages. it is an htacccess thing ? so "/help" => false "/pages" => false "/helpPage?page_id=10" => false "/users" => true and when i say 'not followed by' i mean immediately after the '/', so "/thehelp" => true (?: ) is a non-capturing group. it means you want to group something, usually b/c you're using it with | or * or + . (if you have a "()" without the ?: it will still work but it captures the matches for use in $1, $2, etc if you're using like sed awk pcre oniguruma whatever (?! ) is a kind of 'zero width assertion' it means 'not followed by' (?= ) means 'followed by' and then there's (?