Regular expression to remove last word in a string?
<pre><code>I have a string like this "87 CAMBRIDGE PARK DR".I have used the below regular expression 
to remove the last word "DR", but it also removing the word "PARK" also..
</code></pre>

<p>Below is my code...</p>

<pre><code>String regex = "[ ](?:dr|vi|tes)\\b\\.?"; /*regular expression format*/

String inputString ="87 CAMBRIDGE PARK DR"; /*input string */

Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
            Matcher matcher = pattern.matcher(inputString);
            inputString = matcher.replaceAll("");     

Now the out put is "87 CAMBRIDGE"..
</code></pre>

<p>But I need the out put as "87 CAMBRIDGE PARK"</p>
