regex for hashtag
matches a social media hashtag
^#[^ !@#$%^&*(),.?":{}|<>]*$
Regex Flags
global match
?
ignore case
?
multiline
?
dotAll
?
unicode
?
sticky
?
#Hello
#Photography_Daily
#Photography Daily
#justice4me
Hashtags are metadata tags used on social networks that categorizes the content of the post
Used extensively in social media apps like Twitter and Instagram
Cheatsheet
expr | usage |
---|---|
/\w/ | matches any word character (a-z, A-Z, 0-9, _) |
/[0-9]/ | matches all digits |
/(hello){1,3}/ | matches "hello" that occur between 1 and 3 times (inclusive) |
/^/ | matches beginning of a line |
/$/ | matches end of a line |
iHateRegex
by
geon