title: Java regex predefined character class nested inside character class
body: <p>I need to use a regular expression that contains all the \b characters except the dot, . </p>
  
  <p>Something like <code>[\b&amp;&amp;[^.]]</code></p>
  
  <p>For example, in the following test string:</p>
  
  <p><code>"somewhere deep down in some org.argouml.swingext classes and"</code></p>
  
  <p>I want <code>org.argouml.swingext</code> string to match but <code>org.argouml</code> string not too match. (Using the <a href="http://download.oracle.com/javase/6/docs/api/java/util/regex/Matcher.html#find%28%29" rel="nofollow noreferrer"><code>Matcher.find()</code></a> method)</p>
  
  <p>If I use: <code>\b(package_name)&gt;\b</code> they both match, which is not what I want.</p>
  
  <p>If I use: <code>\b(package_name)[\b&amp;&amp;[^\.]]</code> I get a <a href="http://download.oracle.com/javase/6/docs/api/java/util/regex/PatternSyntaxException.html" rel="nofollow noreferrer"><code>PatternSyntaxException</code></a></p>
  
  <p>If I use: <code>\b(package_name)(\b&amp;&amp;[^\.])</code> nothing matches.</p>
  
  <p>I use <a href="http://www.cis.upenn.edu/~matuszek/General/RegexTester/regex-tester.html" rel="nofollow noreferrer">this link</a> to test my regexes.</p>
  
  <p>Context: I have a list of package names from a project and I have to search them inside some texts. Obviously if a nested package is found, I don't want the outer package to match as well, as seen from the above example.</p>
  
  <p>I am not using the <code>\s</code> character class at the end because the package may be at the end of line, or it may followed by other nonword characters such as <code>:</code> , <code>)</code> etc, characters that are contained in the <code>\b</code> class. I just want to subtract the . from the \b class.</p>
  
  <p>If anybody knows how to do this, I would be very grateful :)
  Thanks</p>