Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

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: [mg109650] Re: and a type of regular expression
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Mon, 10 May 2010 06:38:34 -0400 (EDT)

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?

In[2]:= Cases[
  DictionaryLookup[{"English",
    RegularExpression[
     "d....k"]}], _?(SameQ @@ (Characters[#][[{3, 4}]]) &)]

Out[2]= {dybbuk}



  • Prev by Date: Re: How to write reports and books in Mathematica
  • Next by Date: Re: help with DictionaryLookup[] and a type of regular expression
  • Previous by thread: Re: help with DictionaryLookup[] and a type of regular expression
  • Next by thread: Re: and a type of regular expression