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

Function findUrlInstances

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

Source from the content-addressed store, hash-verified

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@%_\+~#//=])?)`)
406 matches := regex.FindAllStringIndex(input, -1)
407 results := []bridge.FacetParsing{}
408 for _, match := range matches {
409 results = append(results, bridge.FacetParsing{
410 Start: match[0] + 1,
411 End: match[1],
412 Item: input[match[0]+1 : match[1]],
413 })
414 }
415 return results
416}
417
418func findTagInstances(input string) []bridge.FacetParsing {
419 regex := regexp.MustCompile(`#[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