Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #29371

Re: A question about a solution from codingbat.com

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 2014-07-27 23:02 +0000
Organization A noiseless patient Spider
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>

Show all headers | 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


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