本文介绍了URL Validator的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! Hello All, 我的正则表达式有问题。我需要验证以下网址 http://50.244.41.23/ 或 http:// myserver / 我使用了以下表达式 正则表达式urlRx = new 正则表达式( @ (http | https): //([0-9] *),RegexOptions.IgnoreCase); 正则表达式urlRx = 新正则表达式( @ (HTTP | HTTPS)://(?\b(:\d {1,3} \){3} \d {1,3} \b。),RegexOptions.IgnoreCase); 两者都在一定程度上正在发挥作用,但它没有达到目的。它为以下字符串提供了成功,但我希望表达式对这些字符串失败.. http://50.244.41.23 \ http://256.244.41.23/ http://256.244.41.23.123/ 有人可以帮助为上面的url创建一个apt正则表达式验证。 谢谢 Sebastian 解决方案 Hello All,I have an issue with regular expression. I need to validate for the following urlhttp://50.244.41.23/ or http://myserver/I have used following expressionsRegex urlRx = new Regex(@"(http|https)://([0-9]*)", RegexOptions.IgnoreCase);Regex urlRx = new Regex(@"(http|https)://(\b(?:\d{1,3}\.){3}\d{1,3}\b)", RegexOptions.IgnoreCase);Both are working up to an extent, But it doesn't serve the exact purpose. It gives success for the following strings, But i want the expression to fail for such strings..http://50.244.41.23\http://256.244.41.23/http://256.244.41.23.123/Can someone help to create an apt regex validation for the above url.ThanksSebastian 解决方案 这篇关于URL Validator的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-12 11:36