On Tue, 2009-09-15 at 10:10 +0200, Gregory Machin wrote: > Any numbers, but only 3 digits in the string. > > I'm filtering out local extention numbers from phone numbers > > Where in the log the extension is 104 and the phone number would be > something like PSTN0/2-0115070545. All the stuff I have tried have > returned would return both the extension number and 3 digits from the > phone number eg 011 . > > So I only want the records that beginning and end in a number and > have exactly 3 digits not longer. > > Thanks for you time. > G >
Ah, so you do want to anchor at the beginning and end of the string. Have you looked at perlrequick (http://perldoc.perl.org/perlrequick.html) as Uri suggested? That should show you how to anchor a regex to the start and end of a string. Post what you're trying after looking there. Regards, Tim Bowden BTW, please try not to top post. It breaks the flow of the thread. > > On Tue, Sep 15, 2009 at 9:52 AM, Tim Bowden <tim.bow...@mapforge.com.au> > wrote: > > On Tue, 2009-09-15 at 09:30 +0200, Gregory Machin wrote: > >> Hi > >> > >> I'm look for code example that will only select a string containing 3 > >> digits .. The string cant be less than 3 digit , can't be more than 3 > >> and can't contain any other characters. > >> > >> I have googled and found code that will find 3 consecutive digits > >> within a string or at the beginning. > >> > >> Any ideas ? > >> Thanks > >> G > >> > > > > So you want a regex that will identify a three digit string (any 3 > > digits or 3 specified digits?) and anchor to both the start and end of > > the string? > > > > Tim Bowden > > > > > > -- > > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > > For additional commands, e-mail: beginners-h...@perl.org > > http://learn.perl.org/ > > > > > > > -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/