Php:正则表达式,用于查找字符串之间的文本[重复]

Possible Duplicate:
RegEx How to find text between two strings

I am new to REGEX and learning..this is emergency and some one need to help me, how can i get a value 6Lf4 (dynamic value) ,

 private="key" value="6Lf4" sent="yut"

P.s there are lots of attribitute named "Value" in an string, so i need some regex to find string between ="key" value=" , and "

This should work given a strict format:

$matches = array();
preg_match_all('/="key" value="([^"]*)"/', $inputString, $matches);

This tests specifically for the given format with no exceptions. If there is a variable amount of whitespace between "key" and value, you can change the regex to have key"\s+value instead.