帮我找到链接验证的正则表达式? [英] help me find the regular expression for link validation?

查看:53
本文介绍了帮我找到链接验证的正则表达式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我正在使用的正则表达式:

This is the regex i am using:

var regex = /(^(?:http(s)?\:\/\/www\.)(?:[-a-z0-9]+\.)*[-a-z0-9]+.*)(?:.com|.in|.org)$/;





它正在验证http(s),www和(.com / .in / .org)部分。但我只希望这三个中有一个出现。我做了什么?



it is validating http(s),www and the (.com/.in/.org) part. but i want only one occurrence of these three. what shud i do?

推荐答案

/;





它正在验证http(s),www和(.com / .in / .org)部分。但我只希望这三个中有一个出现。我该怎么做?



it is validating http(s),www and the (.com/.in/.org) part. but i want only one occurrence of these three. what shud i do?


你好,



试试这个..



1)网址验证REGEX - 网址仅对http有效: //

2)检查字符串是否为有效URL的最佳正则表达式是什么?


这篇关于帮我找到链接验证的正则表达式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆