Dear All,

Many thanks for all your kind suggestions on my request. I solved my issues
with the command "Test [0-9.]+".

Regards,
MadYuv

On Tue, Dec 20, 2011 at 7:55 PM, Dermot <paik...@gmail.com> wrote:

> On 20 December 2011 13:45, Saravanan Murugaiah
> <saravanan.muruga...@gmail.com> wrote:
> > Dear All,
>
> Hello
>
> > I am a learner in Perl and this is my first post in this group. I need to
> > search a word "Test 1.2.1" in my file. I am using "$_ =~m/Test \d+", but
> it
> > searched only "Test 1" not the full content. I need to check whether it
> is
> > "Test 1" or "Test 1.2" or "Test 1.2.1". Kindly help me in this regard
>
> Your search expression says match the work 'Test' then some literal
> whitespace the any number of digits. But you have not accounted for
> the periods/dots/full stops.
> I think an regular expression like this would help.
>
> /test\s+\d+(?=\.\d+)*/i
>
> /s+ matches whitespace including tabs
> ?= means look ahead from the match just found EG: 'Test 1' and see if
> you can find a literal . followed by one or more digits. The * mean
> zero or more times.
> the i flags means make the search case-insensitive.
>
> Have a look at perldoc perlretut
> (http://perldoc.perl.org/perlretut.html) for more tips.
> Good luck,
> Dermot.
>

Reply via email to