title: Match a pattern and write the stream to a file using Java 8 Stream
body: <p>I'm trying to read a huge file and extract the text within "quotes" and put the lines into a set and write the content of the set to a file using Java 8 <code>Stream</code>.</p>
  
  <pre><code>public class DataMiner {
  
      private static final Pattern quoteRegex = Pattern.compile("\"([^\"]*)\"");
  
      public static void main(String[] args) {
  
          String fileName = "c://exec.log";
          try (Stream&lt;String&gt; stream = Files.lines(Paths.get(fileName))) {
              Set&lt;String&gt; dataSet = stream.
                      //How do I Perform pattern match here
                      .collect(Collectors.toSet());
              Files.write(Paths.get(fileName), dataSet);
  
          } catch (IOException e) {
              e.printStackTrace();
          }
  
      }
  }
  </code></pre>
  
  <p>Please help me. Thanks!</p>
  
  <p>EDIT: Answers to the questions..</p>
  
  <ol>
  <li>No there are no multiple quoted texts. </li>
  <li>I could have used simple loop. But I want to use Java 8 streams</li>
  </ol>