Jump to content

Regular expressions [solved]


Recommended Posts

I expected this to find words in a word-list which had at least 8 characters and no more than 9.

egrep '[A-Za-z]{8,9}' wordlist

 

My problem is that the 9 doesn't seem to make any difference.

 

So I guess I don't really understand how this works.

 

A number of books and tutorials seem to suggest that n is finite

 

Match only n times {n} but this clearly doesn't seem to be the case.

Seems really to be match at least n times.

 

Could some regex guru explain this in small words? I did this last year and don't remember being surprised by the results!

Link to comment
Share on other sites

Actually I forgot a couple of things

 

should have been:

 

egrep '^[A-Za-z]{8,9}$' examples

 

which works - just shows you your memory goes as you get older..........

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...