How to validate a LinkedIn public profile url

后端 未结 9 2706
迷失自我
迷失自我 2021-02-20 16:43

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

9条回答
  •  旧时难觅i
    2021-02-20 16:50

    I've simply used the following regex:

    http(s)?:\/\/([w]{3}\.)?linkedin\.com\/in\/([a-zA-Z0-9-]{5,30})\/?
    

    According to the latest Linkedin documentation custom profile url can have 5-30 letters or numbers.

    It works for the following list of url:

    https://www.linkedin.com/in/your-profile-5-30-length/
    https://linkedin.com/in/your-profile-5-30-length/
    http://www.linkedin.com/in/your-profile-5-30-length/
    http://linkedin.com/in/your-profile-5-30-length/
    

提交回复
热议问题