pat_mc has asked for the wisdom of the Perl Monks concerning the following question:
This returns _'nada_'komo_el_'sol_ rather than _'nada_'komo_'el_'sol_. The second match is missed out on because the match position has already passed beyond the underscore separating komo and el. I believe that what I need is a re-assignment of pos($string) -- after each match ... only, I don't know how to include this into the regex. Your help with this would therefore be much appreciated.#! /usr/bin/perl -w use strict; use locale; my $string = "_'nada_komo_el_'sol_"; $string =~ s/(_)([^']+?)(_)/$1'$2$3/go; print $string;
|
|---|