Go (RE2)

LinkedIn Profile URL in GO

Match LinkedIn profile URLs and capture the profile slug.

Try it in the GO tester →

Pattern

regexGO
https?:\/\/(?:www\.)?linkedin\.com\/in\/([\w\-]{3,100})\/?   (flags: g)

Go (RE2) code

goGo
package main

import (
	"fmt"
	"regexp"
)

func main() {
	re := regexp.MustCompile(`https?:\/\/(?:www\.)?linkedin\.com\/in\/([\w\-]{3,100})\/?`)
	input := `Find me at https://linkedin.com/in/satyanadella`
	for _, match := range re.FindAllString(input, -1) {
		fmt.Println(match)
	}
}

Uses `regexp.MustCompile` (panics on bad patterns at startup) and `FindAllString` for all matches.

How the pattern works

https?:\/\/(?:www\.)?linkedin\.com\/in\/ matches the canonical profile URL prefix (with optional www). ([\w\-]{3,100}) captures the slug — letters, digits, underscores, and hyphens, 3–100 chars. \/? allows an optional trailing slash.

Examples

Input

Find me at https://linkedin.com/in/satyanadella

Matches

  • https://linkedin.com/in/satyanadella

Input

https://www.linkedin.com/in/jane-doe-12345/

Matches

  • https://www.linkedin.com/in/jane-doe-12345/

Input

no linkedin links

No match

Same pattern, other engines

← Back to LinkedIn Profile URL overview (all engines)