C#RegEx匹配模式 [英] C# RegEx Match Pattern Exactly

查看:139
本文介绍了C#RegEx匹配模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想完全匹配的字符串,例如我有希望
键匹配相互独立的两个表达式。表达式是

I'm wanting to match a string exactly, for instance I have two expressions that I want to match independent of each other. Expressions are

/SignUpFor

/SignUpFor/ThankYou

字符串/ SignUpFor返回第一个表达式这是正确的匹配;字符串/ SignUpFor /三江源返回上都有了比赛。

The string "/SignUpFor" returns a match on the first expression which is correct; the string "/SignUpFor/ThankYou" returns a match on both.

我怎样才能获得SignUpFor /三江源只是为了配合表达 / SignUpFor /三江源

How can I get "SignUpFor/ThankYou" just to match with the expression /SignUpFor/ThankYou.

我不只是使用==的原因是,我还有其他表现形式,例如 / TheLovelyBlog /项/([0-9] +)

The reason I'm not just using "==" is that I have other expressions such as /TheLovelyBlog/Entry/([0-9]+)

这些表达都存储在数据库中。

These expression are stored in a database.

推荐答案

把^在开始和结束时
HTTP ://msdn.microsoft.com/en-us/library/h5181w5w.aspx

这篇关于C#RegEx匹配模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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