2代码段错误 [英] 2 Errors On Code Snippet

查看:97
本文介绍了2代码段错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第一部分出现错误,错误的声明和行未正确结束

另外,第二部分的错误未正确结束.

I''m getting an eror on the first part, incorrect declaration and line not ending properly

Also an error on the second part not ending properly.

Unsigned Char Regex RgUrl;
Regex RgxUrl = new Regex("(([a-zA-Z][0-9a-zA-Z+\\-\\.]*:)?/{0,2}[0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%]+)?(#[0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%]+)?");
if (RgxUrl.IsMatch(txtUrl.Text))
{
   MessageBox.Show("URL is valid.");
}
else
{
   MessageBox.Show("URL is invalid!");
}

推荐答案

\\.\\ -_!〜*'()%] +)?(#[0-9a-zA-Z ;/?:@& = +
\\.\\-_!~*'()%]+)?(#[0-9a-zA-Z;/?:@&=+


\\.\\ -_!〜*'()%] +)?") 如果(RgxUrl.IsMatch(txtUrl.Text)) { MessageBox.Show(" ); } 别的 { MessageBox.Show(" ); }
\\.\\-_!~*'()%]+)?"); if (RgxUrl.IsMatch(txtUrl.Text)) { MessageBox.Show("URL is valid."); } else { MessageBox.Show("URL is invalid!"); }


此正则表达式几乎匹配所有内容(如果完全限制了匹配项).很难说出您的想法,但是URL验证通常看起来更简单.

这是有关URL验证主题的正则表达式的集合: http://regexlib.com/Search.aspx?k=URL [^ ].

他们中的任何人都可以满足您的需求吗?

—SA
This Regular Expression matched almost everything (if limits the matches at all). Hard to say what was your idea, but URL validation usually looks simpler.

This is a collection of Regular Expressions on the URL validations topics: http://regexlib.com/Search.aspx?k=URL[^].

Do any of them do what you need?

—SA


这篇关于2代码段错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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