Skip to main content
Regexflux

Hashtag

beginner

Matches social media hashtags.

socialhashtagtwittervalidation

Pattern

/#[a-zA-Z]\w{0,139}/g

Try 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

LanguageSupport
JSFull support
PYTHONFull support
JAVAFull support
PHPFull support
GOFull 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);

Related Patterns