Regex match, pretty simple:

I am looking for consistency with Twitter regex syntax.

How can I compare everything that is "@______", that is, begins with the @ symbol, and not spaces after it, just letters and numbers to the end of the word? (For tweeters, I want the person’s name to respond)

+3
source share
5 answers

Go to

/@(\w+)/

to get the corresponding name.

+6
source

@\w+

It's simple?

+5
source

, Twitter 15 , :

@\w{1,15}

-, -, 15 , 15 , .

-, , , .., , "_".

+2
@[\d\w]+

\ d
\ w
[], +

, . .

0

There is a very extensive API for getting the correct twitter names, mentions, etc. The Java API provided by Twitter can be found on github twitter-text-java . You can take a look at it to make sure that this is what you can use.

I used it to check Twitter names and it works very well.

0
source

Source: https://habr.com/ru/post/1714351/


All Articles