Remove Punctuation issue
<p>Im trying to find a word in a string. However, due to a period it fails to recognize one word. Im trying to remove punctuation, however it seems to have no effect. Am I missing something here? This is the line of code I am using: <strong>s.replaceAll("([a-z] +) [?:!.,;]*","$1");</strong></p>

<pre><code>String test = "This is a line about testing tests. Tests are used to examine stuff";
    String key = "tests";
    int counter = 0;


    String[] testArray = test.toLowerCase().split(" ");

    for(String s : testArray)
    {
        s.replaceAll("([a-z] +) [?:!.,;]*","$1");
        System.out.println(s);
        if(s.equals(key))
        {
            System.out.println(key + " FOUND");
            counter++;
        }
    }

    System.out.println(key + " has been found " + counter + " times.");
}
</code></pre>

<p>I managed to find a solution (though may not be ideal) through using <strong>s = s.replaceAll("\W","")</strong>; Thanks for everyones guidance on how to solve this problem.</p>
