试试这个下面的代码。
var myPattern:RegExp = /(?<==).+(?=&)/;
var str:String = "http://vandooren.be?v=123456&test=123";
var result:Array = myPattern.exec(str);
trace(result[0]); //123456
var myPattern:RegExp = /(?<==).+(?=&)/;
var str:String = "youtube.com/watch?v=nCgQDjiotG0&feature=youtube_gdata";
var result:Array = myPattern.exec(str);
trace(result[0]); //nCgQDjiotG0
Assertions
foo(?=bar) Lookahead assertion. The pattern foo will only match if followed by a match of pattern bar.
foo(?!bar) Negative lookahead assertion. The pattern foo will only match if not followed by a match of pattern bar.
(?<=foo)bar Lookbehind assertion. The pattern bar will only match if preceeded by a match of pattern foo.
(?<!foo)bar Negative lookbehind assertion. The pattern bar will only match if not preceeded by a match of pattern foo.