From: Bill Rowe on
On 5/9/10 at 7:51 AM, nycstern(a)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}


From: David Bevan on

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

does what you want using a regex.

David %^>


> On 5/9/10 at 7:51 AM, nycstern(a)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?

From: Michael Stern on
You are my hero.

Michael



David Bevan wrote:
> RegularExpression["d.(.)\\1.k"]
>
> does what you want using a regex.
>
> David %^>
>
>
>
>> On 5/9/10 at 7:51 AM, nycstern(a)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?
>>>
>