开发者

regex 'literal' meaning in regex

开发者 https://www.devze.com 2023-01-13 07:26 出处:网络
is t开发者_C百科here a way to treat a section of your regex string \'as is\'? I.e. I want to match for the literal pattern: \"[^*..@/w$[{\" in some text (exaggerated example, but you see what I mean

is t开发者_C百科here a way to treat a section of your regex string 'as is'?

I.e. I want to match for the literal pattern: "[^*..@/w$[{" in some text (exaggerated example, but you see what I mean)... Can I just enclose the whole bit in something?


Use Regex.Escape.
See http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.escape.aspx

0

精彩评论

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