Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #29371
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: A question about a solution from codingbat.com |
| Date | Sun, 27 Jul 2014 23:02:30 +0000 (UTC) |
| Organization | A noiseless patient Spider |
| Lines | 14 |
| Message-ID | <slrnltb186.fp3.avl@login.logic.tuwien.ac.at> (permalink) |
| References | <07898d55-9606-44a7-8298-8f5f1c9094c6@googlegroups.com> <1lpdyjk.15qjk7uxkafkwN%rossano.basile@tiscali.it> |
| Reply-To | avl@logic.at |
| Injection-Date | Sun, 27 Jul 2014 23:02:30 +0000 (UTC) |
| Injection-Info | mx05.eternal-september.org; posting-host="7fd0c836d94caf9f0b88d96117d7c68e"; logging-data="1691"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+U7iNUwYPFeuIbijcyYFfk" |
| User-Agent | slrn/pre1.0.0-18 (Linux) |
| Cancel-Lock | sha1:4KIbqjwPpDtoxE7ryN/gSfSvnlY= |
| Xref | csiph.com comp.lang.java.programmer:29371 |
Show key headers only | View raw
Rossano Basile <rossano.basile@tiscali.it> wrote:
><cdalten@gmail.com> wrote:
>> The solution in question is the doubleX problem found at...
>> http://codingbat.com/prob/p186759
>
> static boolean doubleX(String str) {
> return str.matches("^[^x]*x{2,}.*$");
> }
You might need to insert "(?s)" at the begin of the RE, or it might fail
to work with input containing newline characters behind the x's. (*) ;-)
Alternatively, you can also just omit the ".*$" ...
(*): http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#DOTALL
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread
A question about a solution from codingbat.com cdalten@gmail.com - 2014-07-24 17:26 -0700
Re: A question about a solution from codingbat.com Arne Vajhøj <arne@vajhoej.dk> - 2014-07-24 20:47 -0400
Re: A question about a solution from codingbat.com cdalten@gmail.com - 2014-07-24 18:39 -0700
Re: A question about a solution from codingbat.com Arne Vajhøj <arne@vajhoej.dk> - 2014-07-24 21:43 -0400
Re: A question about a solution from codingbat.com thinbluernime <thinbluernime3@gmail.com> - 2014-07-25 03:52 +0000
Re: A question about a solution from codingbat.com Joerg Meier <joergmmeier@arcor.de> - 2014-07-25 08:05 +0200
Re: A question about a solution from codingbat.com Leif Roar Moldskred <leifm@huldreskog.lan> - 2014-07-25 01:19 -0500
Re: A question about a solution from codingbat.com rossano.basile@tiscali.it (Rossano Basile) - 2014-07-26 10:05 +0200
Re: A question about a solution from codingbat.com Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-07-27 23:02 +0000
csiph-web