Hashtag
beginnerMatches social media hashtags.
socialhashtagtwittervalidation
Pattern
/#[a-zA-Z]\w{0,139}/gTry It
0 of 7 strings matched
Explanation
Matches # followed by a letter and up to 139 more word characters. Hashtags must start with a letter (not a digit).
Test Strings
Matching
- #JavaScript
- #DaysOfCode100
- #regex
Non-matching
- #
- #123
- no-hash
- # space
Language Compatibility
| Language | Support |
|---|---|
| JS | Full support |
| PYTHON | Full support |
| JAVA | Full support |
| PHP | Full support |
| GO | Full support |
Code Snippets
const regex = /#[a-zA-Z]\w{0,139}/g;
const text = "your text here";
const matches = text.match(regex);
console.log(matches);