Fix username/hashtag regexp

This commit is contained in:
Alexander Sheiko 2020-12-18 15:26:59 +02:00
parent 0ad2a275ea
commit 5d02321705

View file

@ -11,9 +11,9 @@ import (
) )
var ( var (
reHashtag = regexp.MustCompile(`\B(\#[a-zA-Z]+\b)`) reHashtag = regexp.MustCompile(`\B(\#\w+\b)`)
reTwitterURL = regexp.MustCompile(`https:(\/\/t\.co\/([A-Za-z0-9]|[A-Za-z]){10})`) reTwitterURL = regexp.MustCompile(`https:(\/\/t\.co\/([A-Za-z0-9]|[A-Za-z]){10})`)
reUsername = regexp.MustCompile(`\B(\@[a-zA-Z]+\b)`) reUsername = regexp.MustCompile(`\B(\@\S{1,15}\b)`)
) )
func (s *Scraper) newRequest(method string, url string) (*http.Request, error) { func (s *Scraper) newRequest(method string, url string) (*http.Request, error) {