LinkedIn Profile URL in JS
Match LinkedIn profile URLs and capture the profile slug.
Try it in the JS tester →Pattern
regexJS
https?:\/\/(?:www\.)?linkedin\.com\/in\/([\w\-]{3,100})\/? (flags: g)JavaScript / ECMAScript code
jsJavaScript
const re = new RegExp("https?:\\/\\/(?:www\\.)?linkedin\\.com\\/in\\/([\\w\\-]{3,100})\\/?", "g");
const input = "Find me at https://linkedin.com/in/satyanadella";
const matches = [...input.matchAll(re)];
console.log(matches.map(m => m[0]));Uses `String.prototype.matchAll` for global iteration (Node 12+ / all modern browsers).
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/satyanadellaMatches
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 linksNo match
—