How to remove some words from a string
<p>I want to remove certain words from a string. The words I want to remove are: "a", "an", "and", "the", "of", and "or". </p>

<p>I used the following method:</p>

<pre><code> void doNoiseEliminator(Vector&lt;String&gt; input){

        noNoiseLines = new Vector&lt;String&gt;();
        String temp;   

        for(int i = 0; i &lt; input.size(); i++) {

            String regex = "(\\sand\\s)|(\\sa\\s)|(\\sthe\\s)|(\\san\\s)|(\\sof\\s)|(\\sor\\s)";
            temp = input.get(i).replaceAll(regex, " ");
            noNoiseLines.add(temp);            
        }
    }
</code></pre>

<p>But this does not seem to work. My program takes a string line and circular shifts the line.</p>

<p>For the following input : </p>

<p>MY NAME IS JOHN <br>
MY NAME IS AN A SAM <br>
MY NAME IS OR RAW <br></p>

<p>Output is :</p>

<ol>
<li>a sam my name is </li>
<li>is a sam my name </li>
<li>is john my name </li>
<li>is raw my name </li>
<li>john my name is </li>
<li>my name is a sam </li>
<li>my name is john </li>
<li>my name is raw </li>
<li>name is a sam my </li>
<li>name is john my </li>
<li>name is raw my </li>
<li>raw my name is </li>
<li>sam my name is a </li>
</ol>

<p>Why is this happening? How can I correct this? Please help me. Thanks...!!!</p>
