On Thu, Apr 2, 2009 at 6:26 PM, Robert Citek <[email protected]> wrote:
>
> In a list of words, what regular expression will find all five-letter
> words that begin with "b" and do not end with the same last two
> characters?
>
> Here's a regular expression that will find all five-letter words that
> begin with "b" and do end with the same last two characters:
>
> $ egrep -i '^b..(.)\1$' /usr/share/dict/words
> Bragg
> Brett
> Britt
> bless
> bliss
> bluff
> brass
>
Robert, I wondered that myself.
> But is there a way to do this in a single regular expression?

Sorry, for the late response but playing around with this the last
half-hour yielded this.
$ grep -ic '^b.\(.\).\1$' /usr/share/dict/words
16

$ grep -i '^b.\(.\).\1$' /usr/share/dict/words
Beebe
Benin
Bioko
Bunin
barer
bases
basis
basks
basts
bests
bided
boded
borer
bus's
buses
busts

Thanks for the challenge, Robert.

-- 
()  ascii ribbon campaign - against html mail
/\                   - against microsoft attachments

you must know the ledge of wise and dome to understand your culture of freedom!

http://pxpippen.blogspot.com/

Powerfull Allah

--~--~---------~--~----~------------~-------~--~----~
Central West End Linux Users Group (via Google Groups)
Main page: http://www.cwelug.org
To post: [email protected]
To subscribe: [email protected]
To unsubscribe: [email protected]
More options: http://groups.google.com/group/cwelug
-~----------~----~----~----~------~----~------~--~---

Reply via email to