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

Re: OT: regex pattern problem



On Tue, Jan 06, 2004 at 09:43:28PM -0700, s. keeling wrote:
> Incoming from Craig Tinson:
> > guys.. regex patterns are a *complete* mystery so am hoping someone can
> > help with one..
> > 
> > I have to find all entries in a file which match the following:
> > 
> > (pg. 2)
> 
> Which tool?  I believe perl's would be:
> 
>   /\(pg\. [0-9]*\)/
> 
> or:
> 
>   /\(pg\. \d+\)/
> 
> 
> Shell would be:
> 
>   \(pg\. [0-9]*\)

i noticed you used * in two cases and + in another, I should think you'd 
want to use +, or if the program only supports *: [0-9][0-9]*

and sed without the "-r" switch would interpret \(\) as grouping not 
literal parens



Reply to: