Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!texta.sil.at!newscore.univie.ac.at!aconews-feed.univie.ac.at!aconews.univie.ac.at!not-for-mail Newsgroups: comp.lang.java.programmer From: Andreas Leitgeb Subject: Re: Confusion about String.matches method References: Reply-To: avl@logic.at User-Agent: slrn/pre0.9.9-111 (Linux) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: Date: 31 May 2011 17:28:45 GMT Lines: 19 NNTP-Posting-Host: gamma.logic.tuwien.ac.at X-Trace: 1306862925 tunews.univie.ac.at 60386 128.130.175.3 X-Complaints-To: abuse@tuwien.ac.at Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4804 laredotornado wrote: > Hi, > I'm using Java 1.6. How would I modify my regular expression below > ^Starting at \$32,000*$ ^Starting at \$32,000\*$ > so that it will match the string, "Starting at $32,000*". In other > words, I have > String regEx = "^Starting at \\$32,000*$"; String regEx = "^Starting at \\$32,000\\*$"; > String text = "Starting at $32,000*"; > if (!text.matches(regEx)) { > throw new RuntimeException("does not match"); > } > but the exception is always thrown. Please let me know how can I > modify my reg ex to match. Thanks, - Dave