What is the Java equivalent to this preg_replace?

admin

Administrator
Staff member
Code:
<?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>
?>

source: <a href="http://pureform.wordpress.com/2008/01/04/matching-a-word-characters-outside-of-html-tags/" rel="nofollow noreferrer">http://pureform.wordpress.com/2008/01/04/matching-a-word-characters-outside-of-html-tags/</a>

Unfortunality my project needs a semantic libs avaliable only for Java...

// Thanks Celso