Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: Replacing a specfied instance of a pattern in a string

by ikegami (Pope)
on Jul 14, 2005 at 22:48 UTC ( #475077=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $str      = 'Fsih my test variable is fsihd or is it gfsih or gfsih
    +d fsih';
    #                                        1111            2222     3333
    +  4444
    ...
    $str =~ s/\G(.*?)$regexp/$1$replace/;
    
    print("$str\n");