In this code golf challenge, you will verify hashtags!
#What_your_code_should_do
Input is a string. Output a truthy value if it is a valid hashtag, and a falsy value otherwise.
We define a string as a valid Hashtag if ...
- It starts with a hash (
#
). - It doesn't have a number right after the hashtag (e.g.
#2016USElection
isn't a valid hashtag). - It doesn't have any "special characters" (i.e. any character that isn't an alphabet, underscore (
_
) or a number).
You can assume that the input only contains ASCII characters. (It would be unfair if we did Unicode too.)
#Rules
Basic code-golf rules apply.
#Examples
Truthy:
#
#e
#_ABC
#thisisanunexpectedlylongstringxoxoxoxo
#USElection2016
Falsy:
Hello, World!
#12thBday
#not-valid
#alsoNotValid!
#!not_a_hash
#
really a valid hashtag? \$\endgroup\$#öäü
valid? \$\endgroup\$#
is not a valid hashtag by any system, Facebook or Twitter it also breaks the rules set also im not sure #_ABC is valid again on them but im not certain of that. \$\endgroup\$an alphabet
means ascii uppercase or lowercase letter? i.e.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
? \$\endgroup\$