问题
Here is my regex:
\[\[START\]\]\[\[OK\]\](.*?)\[\[END\]\]
I want to get any text contained in [[START]][[OK]]
and [[END]]
.
However when my text contains some \r\n
characters, my regex doesn't match it.
How can it make it work?
回答1:
Use single-line mode
http://msdn.microsoft.com/en-us/library/yd1hzczs.aspx#Singleline
回答2:
I don't know for sure if this works for RegEx'es as well,but you could try using Environment.NewLine in stead of \r\n.
来源:https://stackoverflow.com/questions/6179116/c-sharp-regex-match-any-text-between-tags-including-new-lines