MCPcopy Create free account
hub / github.com/Preloading/TwitterAPIBridge / findHandleInstances

Function findHandleInstances

twitterv1/interaction.go:390–402  ·  view source on GitHub ↗
(input string)

Source from the content-addressed store, hash-verified

388}
389
390func findHandleInstances(input string) []bridge.FacetParsing {
391 regex := regexp.MustCompile(`@([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?`)
392 matches := regex.FindAllStringIndex(input, -1)
393 results := []bridge.FacetParsing{}
394 for _, match := range matches {
395 results = append(results, bridge.FacetParsing{
396 Start: match[0],
397 End: match[1],
398 Item: input[match[0]+1 : match[1]], // +1 to skip the '@' character
399 })
400 }
401 return results
402}
403
404func findUrlInstances(input string) []bridge.FacetParsing {
405 regex := regexp.MustCompile(`[$|\W](https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*[-a-zA-Z0-9@%_\+~#//=])?)`)

Callers 2

status_updateFunction · 0.85
status_update_with_mediaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected