I am looking for a way to validate a link to make sure that it is pointing to a LinkedIn public profile page in PHP.
I have a website and I would like my users to be abl
This covers most LinkedIn profile URLs (Javascript RegEx):
http://www.linkedin.com/in/username
https://www.linkedin.com/in/username
http://linkedin.com/in/username
https://linkedin.com/in/username
http://www.linkedin.com/mwlite/in/username
https://www.linkedin.com/mwlite/in/username
http://linkedin.com/mwlite/in/username
https://linkedin.com/mwlite/in/username
http://www.linkedin.com/m/in/username
https://www.linkedin.com/m/in/username
http://linkedin.com/m/in/username
https://linkedin.com/m/in/username
// Generic RegEx exact match validator
export const isRegexExactMatch = (value, regexp) => {
const res = value.match(regexp);
return res && res[0] && res[0] === res.input;
};
const isLinkedinProfileUrl = (value) => {
const linkedInProfileURLRegExp =
'(https?:\\/\\/(www.)?linkedin.com\\/(mwlite\\/|m\\/)?in\\/[a-zA-Z0-9_.-]+\\/?)';
return !!isRegexExactMatch(value, linkedInProfileURLRegExp);
};