Well, it definitely can't work like that because echo is wrong, but it would work (if your RegExp is correct) like this:
$string = 'test <OPTION VALUE="test">test</OPTION> test';
$string = preg_replace('/["|>]test["|<]/', 'anotherword', $string);
I know what you mean and I realize why my code doesn't work (the space is either before or after the word test but never at both ends in your example).
I am afraid I haven't quite learned negation (and RegExp for that matter) well enough but I suppose you'd have to negate the entire string of characters, not just the ", so it would be:
$string = 'test <OPTION VALUE="test">test</OPTION> test';
$string = preg_replace('/["|>]test["|<]/', 'anotherword', $string);
Try that, if it doesn't work make a search for posts started by me because I am discussing a similar issue right now and there is this heavy-weight guy called WeedPacket who left me some really good explanations about regexp and negation and all that stuff which would lead you in the right direction...
Also if you have to stick JUST to your example there is another solution which isn't as flexible but doesn't involve RegExp and would be the following:
$string = 'test <OPTION VALUE="test">test</OPTION> test';
$string = str_replace('test ','anotherword ',$string);
$string = str_replace(' test',' anotherword',$string);
Or even this:
$string = 'test <OPTION VALUE="test">test</OPTION> test';
$string = preg_replace('/(\stest\s)/','anotherword',$string);
$string = str_replace('"anotherword"','"test"',$string);
$string = str_replace('>anotherword<','>test<',$string);
Of course if you were to add addslashes() before the preg_replace you would then have to search for "anotherword\" in the last but one line, and if that doesn't work enter "anotherword\\". But you may as well add the addslashes() after everything else so that you don't have to take this extra step of changing the str_replace search string.