|
Posted by Yogi on April 9, 2008, 4:12 am
Please log in for more thread options > Yogi wrote:
> > I have a variable say:
> > $x =3D "this is test program with test inputs";
>
> > My requirement is to replace nth occurrance of "test" with something
> > else. how to achieve the same using perl regex. if i do something
> > like:
> > $x =3D~ s/test/java/g;
>
> > This is going to replace all occurrance of test with "java" but my
> > requirement is to replace say 2nd occurrance only. Any help?
>
> perldoc -q nth
>
> Frank
> --
> Dipl.-Inform. Frank Seitz;http://www.fseitz.de/
> Anwendungen f=FCr Ihr Internet und Intranet
> Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel
Thanks Frank for your help. :)
Regards,
-Yogi
|