<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( "_TM" )<br><br>
You could also do the following if it was more in line with your
needs:<br>
foo[i].endsWith( "_TM" )<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> </x-tab>
boundary="----_=_NextPart_001_01C9F41E.16A2CB20";<br>
<x-tab> </x-tab>
type="multipart/alternative"<br><br>
<font size=2>Hi all,<br>
</font> <br>
<font size=2>What's wrong with my logic and/or regex?<br>
</font> <br>
<br>
<font size=2>I'm parsing a text file, extracting hopefully useful
information from a stated directory path. I have a java
pattern/regex that looks like this:<br>
</font> <br>
<font size=2>String[] languages = new String[2];<br>
String[] foo = inputLine.split("<a href="??">\\\\</a>");<br>
Pattern langs = Pattern.compile("_TM");<br>
int toggle = 0;<br>
for(int i = 0; i < foo.length; i++) {<br>
Matcher m = langs.matcher(foo[i]);<br>
if(m.find() && toggle == 0) { //we have
a language, but it's the first one<br>
toggle = 1;<br>
languages[0] =
fetchLanguageName(foo[i]);<br>
}<br>
else if(m.find() && toggle == 1) {
//the second language we find<br>
toggle = 2;<br>
languages[1] =
fetchLanguageName(foo[i]);<br>
}<br>
}<br>
Given an input line like this:<br>
Translation Memory:
X:\2Checkout\2Checkout_English(U.S.)_TM\2Checkout_Chinese(Traditional)_TM\cht_2CheckOut.tmw<br>
</font> <br>
<font size=2>It quite happily finds the first occurrence of '_TM' but
then fails to trigger on the second. (i.e. we find English but not
Chinese.) <br>
</font><br>
-- <br><br>
Richard Johnson, Systems Architect<?xml:namespace prefix = o ns =
"urn:schemas-microsoft-com:office:office" /><br><br>
Lingo Systems<br><br>
<?xml:namespace prefix = st1 ns =
"urn:schemas-microsoft-com:office:smarttags" />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 503-419-4889 or 800-878-8523<br><br>
FAX 503-419-4873<br><br>
<br><br>
<img src="cid:7.1.0.9.0.20090623093312.03e2fcf0@crc-corp.com.1" width=201 height=83 alt="[]">
<br>
<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>