A
/n
/n
/n
.
.
B
开发者_StackOverflow中文版
Now there can be n no of lines between a and b have to find such content and remove A and B
Simple Regex like
(A)(.*)(B)
would suffice. Add ^
and $
based on start and end. If A and B are start and end respectively use
^(A)(.*)(B)$
Extract the appropriate group.
To make it a bit more complex and without having to use groups, use:
(?<=A)(.*)(?=B)
You have to use RegexOptions.Singleline
to make .
match line breaks.
Edit after comment:
Oh my god, you could have been clearer.
To enable regular expressions, expand Find options in the Find and Replace window,
select Use, and then select Regular expressions. The triangular Expression Builder
buttons next to the Find what and Replace with fields become available. Click the
button to display a list of frequently used regular expressions.
For available expressions and more details : http://msdn.microsoft.com/en-us/library/2k3te2cs(v=VS.100).aspx
精彩评论