Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
The regular exp in this validation is not working.how can i do this?plz help me.
PHP
<?php
echo $this->Html->css(array('jquery.validate'));
echo $this->Html->script(array('jquery.min.1.8.3','jquery.validate', 'jquery.validation.functions'));
?>



HTML
<script type="text/javascript">
    $(function() {
         
		$("#twitter").validate({
             expression: "if (VAL.match(/^(http(s)?:\/\/)?(www\.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/)) return true; else return false;",
            message: "Should be a valid twitter link"
        });
		
	 	  
     });
	 </script>
Posted

1 solution

Have a look at jquery validate it has a special validation for this
http://jqueryvalidation.org/url-method/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900