Regular expression matching, very simple:

I want to match Twitter grammar with regular expressions.

How do I match any “@______”, that is, start with the @ symbol and nothing after it Spaces, only letters and numbers, until the end of the word? (For Twitter, I want to match someone’s name in the reply)

do it

/@(\w+)/

The same goes for obtaining matching names.

I want to match Twitter syntax with regular expressions.

How do I match any “@______”, that is, with the @ symbol At the beginning, there is no space after it, only letters and numbers, until the end of the word? (For Twitter, I want to match someone’s name in the reply)

Go do it

/@(\w+)/

The same goes for obtaining matching names.

< /p>

Leave a Comment

Your email address will not be published.