Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Joshua Cranmer Newsgroups: comp.lang.java.programmer Subject: Re: Confusion about String.matches method Date: Wed, 01 Jun 2011 11:17:47 -0400 Organization: A noiseless patient Spider Lines: 10 Message-ID: References: <50016a00-9422-46d4-8278-619fedafff55@c41g2000yqm.googlegroups.com> <2fd869d6-c2f6-4360-85b4-6df2b6e68fb0@p13g2000yqh.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 1 Jun 2011 15:17:48 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="bAymlyY9SkaJNa8Tz2rerw"; logging-data="32384"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/H520oyU7E5lsfpK95S2x5cBcyqTucWGk=" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.16pre) Gecko/20110305 Lightning/1.0b3pre Thunderbird/3.1.10pre In-Reply-To: <2fd869d6-c2f6-4360-85b4-6df2b6e68fb0@p13g2000yqh.googlegroups.com> Cancel-Lock: sha1:EB8ZHBNsJoNLd8yfkIPBbdzGjlQ= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4858 On 06/01/2011 10:10 AM, laredotornado wrote: > which returns false. If I remove the new line ("\n"), it matches, but > I can't guarantee my input won't contain new lines. How can I modify > my regular expression to match? Thanks, - Dave There is a flag that you can set to treat newlines as regular characters. -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth