title: Java Regex: I wish to return value from double quotes in java, using regex
body: <p>I am trying to return a String value located in double quotes, in java for instance 
  "Home Lone". I am writing a test script to match whats on my UI and that in database. 
  here is sample code</p>
  
  <pre><code>    public String getMonitorKeywords(String keywords1, String keywords2, String keywords3) {
      String words = "";
      if (keywords2 != null &amp;&amp; keywords1 == null &amp;&amp; keywords3 == null) {
          return words = keywords2.replaceAll("\\s+", " AND ");
          }
  
      else if(keywords2 == null &amp;&amp; keywords1 == null &amp;&amp; keywords3 != null){
          keywords2 = keywords3.replaceAll("\\s+", " OR ");
          words = keywords3;
          Util.println("From databse we have third keywords{}: " + words);
          return words;
      }
  
      else if(keywords2 != null &amp;&amp; keywords1 != null &amp;&amp; keywords3 == null){
          words = keywords1;
          Util.println("From databse we have first keywords{}: " + words);
          return words;
      }
  
      else if(keywords2 == null &amp;&amp; keywords1 != null &amp;&amp; keywords3 == null){
          words = keywords1;
          return words;
      }
      else {
          return null;
      }
  }
  </code></pre>
  
  <p>Problem with my method, when keywords2 has words with double quotes {""}, it increments AND into it which i dont want for those particular sets of words. Thanks i know its to do with regex expression to filter out such words with quotes. not all words have quotes.</p>