[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Grep on dictionary words

On Sun, Nov 29, 2009 at 01:22:15AM +0200, Dotan Cohen wrote:
> > will get the ones that start with capital alphas. if you want initial
> > caps *only* then:
> >
> > grep "^[A-Z][a-z]*$"
> >
> > would match those.
> >
> Thanks. I meant that caps could only be at the beginning of a word,
> not in the middle. Expanding your example, I figured that would be:
> grep "^[A-Z]?[a-z]*$"  // note the question mark

> >
> > grep "^[A-Z][a-z]*$"

that's what this does, I believe... 

^[A-Z] means start the line with a capital alpha

[a-z]*$ means end the line with any number (from 0 up) of lowercase

> However my PCRE skills are weak and not working.

mine are none-too-strong either...


Attachment: signature.asc
Description: Digital signature

Reply to: