<?php
$str = "word <a href=\"word\">word</word>word word";
$str = preg_replace("/word(?!([^<]+)?>)/i","repl",$str);
echo $str;
# repl <word word="word">repl</word>
?>
來源:http://pureform.wordpress.com/2008/01/04/matching-a-word-characters-outside-of-html-tags/與此preg_replace相當的Java是什麼?
Unfortunality我的項目需要一個語義庫avaliable只爲Java ...
//感謝塞爾索
您確實需要重新修改此問題。 1)這與java有什麼關係? 2)你期望的輸入和輸出是什麼? – whaley 2010-07-22 00:29:39
預計結果: repl repl repl repl – celsowm 2010-07-22 00:38:36