<p>I am iterating though a TreeSet and printing it out:</p>

<pre><code>while (it.hasNext()) {
  System.out.println(it.next());
}
</code></pre>

<p>output:</p>

<pre><code>after
explorers
giant
hoping
internet
into
.
.
.
virtual 
world
</code></pre>

<p>However, I would like to <i>only</i> print out those strings who's first character is within the range m-z. I have been playing around with java.util.regex, with no success:</p>

<pre><code>String pattern = "[^m-z]";
</code></pre>

<p>Do I have the right idea here? Or is there a simpler way of doing this? All I want to do is make sure I <strong>only print out those Strings in the TreeSet who's first character is within the range m-z.</strong></p>

seems like an homework but anyhow,
the "[^m-z]" means NOT m-z
try putting the "^" outside the "[]"
Have a look at the
Pattern
class
and BTW, try
```
String.matches()
```