<html>
<body>
Richard,<br><br>
Since you are not matching an expression per se, I would recommend the
following for simplicity (as it seems to be what you are looking
for):<br>
foo[i].contains( &quot;_TM&quot; )<br><br>
You could also do the following if it was more in line with your
needs:<br>
foo[i].endsWith( &quot;_TM&quot; )<br><br>
--Zack<br><br>
At 09:17 AM 6/23/2009, Richard Johnson wrote:<br>
<blockquote type=cite class=cite cite="">Content-class:
urn:content-classes:message<br>
Content-Type: multipart/related;<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>
boundary=&quot;----_=_NextPart_001_01C9F41E.16A2CB20&quot;;<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>
type=&quot;multipart/alternative&quot;<br><br>
<font size=2>Hi all,<br>
</font>&nbsp;<br>
<font size=2>What's wrong with my logic and/or regex?<br>
</font>&nbsp;<br>
&nbsp;<br>
<font size=2>I'm parsing a text file, extracting hopefully useful
information from a stated directory path.&nbsp; I have a java
pattern/regex that looks like this:<br>
</font>&nbsp;<br>
<font size=2>String[] languages = new String[2];<br>
String[] foo = inputLine.split(&quot;<a href="??">\\\\</a>&quot;);<br>
&nbsp;&nbsp;&nbsp; Pattern langs = Pattern.compile(&quot;_TM&quot;);<br>
&nbsp;&nbsp;&nbsp; int toggle = 0;<br>
&nbsp;&nbsp;&nbsp; for(int i = 0; i &lt; foo.length; i++)&nbsp; {<br>
&nbsp;&nbsp;&nbsp; Matcher m = langs.matcher(foo[i]);<br>
&nbsp;&nbsp;&nbsp; if(m.find() &amp;&amp; toggle == 0) {&nbsp; //we have
a language, but it's the first one<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; toggle = 1;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; languages[0] =
fetchLanguageName(foo[i]);<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; else if(m.find() &amp;&amp; toggle == 1)&nbsp; {&nbsp;
//the second language we find<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; toggle = 2;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; languages[1] =
fetchLanguageName(foo[i]);<br>
&nbsp;&nbsp;&nbsp; }<br>
}<br>
Given an input line like this:<br>
&nbsp;&nbsp;&nbsp; Translation Memory:
X:\2Checkout\2Checkout_English(U.S.)_TM\2Checkout_Chinese(Traditional)_TM\cht_2CheckOut.tmw<br>
</font>&nbsp;<br>
<font size=2>It quite happily finds the first occurrence of '_TM' but
then fails to trigger on the second.&nbsp; (i.e. we find English but not
Chinese.)&nbsp; <br>
</font><br>
-- <br><br>
Richard Johnson, Systems Architect&lt;?xml:namespace prefix = o ns =
&quot;urn:schemas-microsoft-com:office:office&quot; /&gt;<br><br>
Lingo Systems<br><br>
&lt;?xml:namespace prefix = st1 ns =
&quot;urn:schemas-microsoft-com:office:smarttags&quot; /&gt;15115 SW
Sequoia Pkwy #200<br><br>
Portland Oregon 97224<br><br>
<a href="mailto:richardj@lingosys.com">richardj@lingosys.com</a><br><br>
<a href="http://www.lingosys.com/" eudora="autourl">
http://www.lingosys.com</a><br><br>
voice&nbsp; 503-419-4889 or 800-878-8523<br><br>
FAX&nbsp;&nbsp; 503-419-4873<br><br>
&nbsp;<br><br>
<img src="cid:7.1.0.9.0.20090623093312.03e2fcf0@crc-corp.com.1" width=201 height=83 alt="[]">
<br>
&nbsp;<br><br>
<br>
_______________________________________________<br>
Web Site -
<a href="http://www.pjug.org/" eudora="autourl">http://www.pjug.org/</a>
<br>
Javamail mailing list<br>
Javamail@pjug.org<br>
<a href="http://www.pjug.org/mailman/listinfo/javamail" eudora="autourl">
http://www.pjug.org/mailman/listinfo/javamail</a></blockquote></body>
</html>