WhatIf the RegularExpression Extraction rule does not work for you, then what you're looking for is a custom extraction rule: http://msdn.microsoft.com/en-us/library/ms243179%28v=vs.80%29.aspx
Basically create a method deriving from ExtractionRule and then add the ExtractionRule to your webtest.