开发者

What matches this regex?

This compiles and executes:

 var re = new Regex(@"what\ever");

But I can't find anything that matches it. whatever, what\ever and what\\ever all fail to match.

\e isn't a valid escape sequence AFAIK, so I'm not sure what the intended behaviou开发者_StackOverflow中文版r here is...


I think \e matches the "Escape" character (ASCII code 27). Hence it should match "what\x1bver"


\e is the escape control character

you can use a free tool called The Regulator which has built in intellisense which helps for things like this.


\e is usually equal to \033.


It's the escape sequence (0x1B).

See non printable characters section here.


I think you should use

var re = new Regex(@"[what\ever]");

to match "what\ever"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜