MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: and a type of regular expression

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109667] Re: and a type of regular expression
  • From: David Bevan <david.bevan at pb.com>
  • Date: Tue, 11 May 2010 06:27:17 -0400 (EDT)

RegularExpression["d.(.)\\1.k"]

does what you want using a regex.

David %^>


> On 5/9/10 at 7:51 AM, nycstern at gmail.com (Michael Stern) wrote:
>
> >Is there an elegant way to do dictionary searches that match
> >specified kinds of character repetition? For example, to search for
> >six letter words that start with "d" and end with "k", where the
> >third and fourth letter are the same?
>
> >Finding six letter words that start with "d" and end with "k" is
> >easy --
>
> >DictionaryLookup[{"English", RegularExpression["d....k"]}]
>
> >But how do we restrict the answer to words where the third and
> >fourth letters are the same?


  • Prev by Date: Announce: O'Reilly Mathematica Cookbook Published
  • Next by Date: Cardinality Constraints in quadratic optimization
  • Previous by thread: Re: and a type of regular expression
  • Next by thread: Re: and a type of regular expression