<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18783"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=298073916-23062009><FONT color=#0000ff
size=2 face=Arial>Doh! </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=298073916-23062009><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=298073916-23062009><FONT color=#0000ff
size=2 face=Arial>Thanks, Zack. :-)</FONT></SPAN></DIV><BR>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> Zack Radick [mailto:zack@crc-corp.com]
<BR><B>Sent:</B> Tuesday, June 23, 2009 9:36 AM<BR><B>To:</B> Richard Johnson;
javamail@pjug.org<BR><B>Subject:</B> Re: [PJUG Javamail] Silly Regex
Question<BR></FONT><BR></DIV>
<DIV></DIV>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 class=cite cite="" type="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
alt=[] src="cid:298073916@23062009-2FFF" width=201 height=83>
<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>