regexes

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2022 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// MentionName captures the username and domain part from a mention string
	// such as @[email protected], returning whatever_user and example.org (without the @ symbols)
	MentionName = regexp.MustCompile(mentionName)

	// MentionFinder extracts mentions from a piece of text.
	MentionFinder = regexp.MustCompile(mentionFinder)

	// HashtagFinder finds possible hashtags in a string.
	// It returns just the string part of the hashtag, not the # symbol.
	HashtagFinder = regexp.MustCompile(hashtagFinder)

	// EmojiShortcode validates an emoji name.
	EmojiShortcode = regexp.MustCompile(fmt.Sprintf("^%s$", emojiShortcode))

	// EmojiFinder extracts emoji strings from a piece of text.
	EmojiFinder = regexp.MustCompile(emojiFinderString)

	// Username can be used to validate usernames of new signups
	Username = regexp.MustCompile(fmt.Sprintf(`^%s$`, usernameString))

	// UserPath parses a path that validates and captures the username part from eg /users/example_username
	UserPath = regexp.MustCompile(userPathString)

	// PublicKeyPath parses a path that validates and captures the username part from eg /users/example_username/main-key
	PublicKeyPath = regexp.MustCompile(publicKeyPath)

	// InboxPath parses a path that validates and captures the username part from eg /users/example_username/inbox
	InboxPath = regexp.MustCompile(inboxPath)

	// OutboxPath parses a path that validates and captures the username part from eg /users/example_username/outbox
	OutboxPath = regexp.MustCompile(outboxPath)

	// ActorPath parses a path that validates and captures the username part from eg /actors/example_username
	ActorPath = regexp.MustCompile(actorPath)

	// FollowersPath parses a path that validates and captures the username part from eg /users/example_username/followers
	FollowersPath = regexp.MustCompile(followersPath)

	// FollowingPath parses a path that validates and captures the username part from eg /users/example_username/following
	FollowingPath = regexp.MustCompile(followingPath)

	// FollowPath parses a path that validates and captures the username part and the ulid part
	// from eg /users/example_username/follow/01F7XT5JZW1WMVSW1KADS8PVDH
	FollowPath = regexp.MustCompile(followPath)

	// ULID parses and validate a ULID.
	ULID = regexp.MustCompile(fmt.Sprintf(`^%s$`, ulid))

	// LikedPath parses a path that validates and captures the username part from eg /users/example_username/liked
	LikedPath = regexp.MustCompile(likedPath)

	// LikePath parses a path that validates and captures the username part and the ulid part
	// from eg /users/example_username/like/01F7XT5JZW1WMVSW1KADS8PVDH
	LikePath = regexp.MustCompile(likePath)

	// StatusesPath parses a path that validates and captures the username part and the ulid part
	// from eg /users/example_username/statuses/01F7XT5JZW1WMVSW1KADS8PVDH
	// The regex can be played with here: https://regex101.com/r/G9zuxQ/1
	StatusesPath = regexp.MustCompile(statusesPath)

	// BlockPath parses a path that validates and captures the username part and the ulid part
	// from eg /users/example_username/blocks/01F7XT5JZW1WMVSW1KADS8PVDH
	BlockPath = regexp.MustCompile(blockPath)
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳