Yngvarr

Generation

regex explanationThu, 23 Mar 2023

/\B@[a-z0-9_-]+/g

The regex matches all twitter usernames, the @ is not a word boundary, so the @ is required to be matched before the username. The character class [a-z0-9_-] matches all letters, numbers and underscores. The + is a quantifier which means "one or more of the preceding character". The g modifier means "global", so the regex will find all matches.

Questions about programming?Chat with your personal AI assistant