 <p>I think you're going to have to handle the quotes after you get the token back because in <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#next%28java.util.regex.Pattern%29" rel="nofollow">the <code>Scanner#next(String)</code> method</a>, the regex is used to <em>test</em> the next token, not to <em>determine</em> the next token.</p> <p>So, rather than getting the tokenizer to return <code>x</code>, you're going to have to expect the tokenizer to return <code>'x',</code>, and then make that output work. Fortunately, this isn't hard. A quick and dirty way to do that would look like this:</p> <pre><code>String quotedToken=scanner.next(); quotedToken = quotedToken.replace('\'', ' '); quotedToken = quotedToken.replace(',', ' '); quotedToken = quotedToken.trim(); </code></pre> <p>It's probably also worth noting that you can get the <code>Scanner</code> to handle your commas for you if you get a little clever with your delimiter:</p> <pre><code>`scanner.useDelimiter(",?\\s+");` </code></pre>