msdn中的描述如下:
(?= 子表达式)
(零宽度正预测先行断言。) 仅当子表达式在此位置的右侧匹配时才继续匹配。例如,\w+(?=\d) 与后跟数字的单词匹配,而不与该数字匹配。此构造不会回溯。
(?<= 子表达式)
(零宽度正回顾后发断言。) 仅当子表达式在此位置的左侧匹配时才继续匹配。例如,(?<=19)99 与跟在 19 后面的 99 的实例匹配。此构造不会回溯。
msdn描述的比较清楚,
如:\w+(?=ing) 可以匹配以ing结尾的单词(匹配结果不包括ing),
(?<=Red-)\w+,匹配Red- 后边的单词。

1

using System;
2

using System.Collections.Generic;
3

using System.Text;
4

using System.Text.RegularExpressions;
5

6

namespace practice
7

{
8

public class myclass
9

{
10

public static void Main() {
11

Regex pattern1 = new Regex(@"(?<=Red-)\w{3}");
12

13

MatchCollection match = pattern1.Matches("Red-abc");//Only get "abc"
14

foreach (Match one in match) {
15

System.Console.WriteLine("===="+one.Value);
16

}
17

18

pattern1 = new Regex(@"Red-(?<=Red-)\w{3{");
19

20

match = pattern1.Matches("Red-abc");//Could get the whole word including "Red-"
21

foreach (Match one in match) {
22

System.Console.WriteLine("+++++" + one.Value);
23

}
24

return;
25

}
26

}
27

}
下面讲下我的理解:
(1).零宽度
这表示匹配是一个位置(Loaction)而不是子表达式。
(2).预测先行,回顾后发
(?= 子表达式),预测先行, 返回与子表达式匹配的前面位置,从做左到右匹配。
(?<= 子表达式),回顾后发,返回与子表达式匹配的后边位置,从右到左匹配。
我们可以想象有在模式匹配过程中有一指针标志当前匹配的位置,这样当子表达式匹配时 预测先行 把指针指到子表达式前边,回顾后发则为后边。可以参考上边代码。
转自:http://www.cnblogs.com/creek/archive/2009/04/04/1429600.html