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

Re: Question relating regexp



Robert.Land@t-online.de (Robert Land) writes:

> =Why, in the first example, has the author
> prefaced the char 'K' with the one or more
> times multiplier? He only wants to find a 
> name beginning with 'K'(!)

The * applies to the space before the k, so "  *" means "one or more
spaces".  In other words, you have to match the space before the K.

> Then, in the snd grep command he doubled
> '[0-9]', wouldn't only '^1[0-9]*....'be 
> sufficent? 

'^1[0-9]*' would match 

1 K...
12 K ...

Doubling the [0-9] means that there has to be at least one digit
after the 1.

-- 
Alan Shutko <ats@acm.org> - In a variety of flavors!



Reply to: