RegEx Validation for Linkedin Profile

Posted by Kedarasp under ASP.NET on 3/6/2014 | Points: 10 | Views : 19659 | Status : [Member] | Replies : 4
I just want to make a textbox valid which should only accept Linkedin Profiles. I'm using the following RegularExpression, but this is not working.


<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtLinkedin" CssClass="required" Display="Dynamic" ErrorMessage="Invalid!" ValidationExpression="(http(s?)://|[a-zA-Z0-9\-]+\.|[linkedin])[linkedin/~\-]+\.[a-zA-Z0-9/~\-_,&=\?\.;]+[^\.,\s<]" ValidationGroup="form1"></asp:RegularExpressionValidator>

The above expression is accepting URLs which doesn't have www like
http://in.linkedin.com/pub/kedar-nayak/19/54b/154

But not accepting the following URL which has www
http://www.linkedin.com/pub/kedar-nayak/19/54b/154
Please suggest me the right regularexpression which can accept LinkedIn Profiles only.

Thank you.




Responses

Posted by: Bandi on: 3/6/2014 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Refer this link once.
http://stackoverflow.com/questions/8450403/how-to-validate-a-linkedin-public-profile-url

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Kedarasp, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kedarasp on: 3/6/2014 [Member] Starter | Points: 25

Up
0
Down
Please try once before answering this question. I've asked for Asp .Net , not for PHP.

Kedarasp, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 3/6/2014 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Hello,

Try to tweet the code as per your requirement...
Last response in the posted link is regular expression

var linkedin=/(ftp|http|https):\/\/?((www|\w\w)\.)?linkedin.com(\w+:{0,1}\w*@)?(\S+)(:([0-9])+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;


Sometimes we may not have sufficient time to tweet your exact requirement. So better to try once...

Note : I would thought of the above expression can help you

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Kedarasp, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 3/6/2014 [Member] [MVP] Platinum | Points: 25

Up
0
Down
refer
http://www.dotnetspider.com/forum/317109-Need-Regular-Expression-to-valid-URL.aspx

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Kedarasp, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response