good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Modifying the match position after each matchby pat_mc (Pilgrim) |
on Mar 23, 2010 at 20:54 UTC ( [id://830400]=perlquestion: print w/replies, xml ) | Need Help?? |
pat_mc has asked for the wisdom of the Perl Monks concerning the following question:
Honerable Monks - I am stuck with a regex problem and need your help (again, I know). I simply want to replace all matches in string. I am trying to include a single quote in front of every string in between underscores that does not contain a single quote yet. Here is the code that I tried: 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. Thanks in advance and best regards - Pat
Back to
Seekers of Perl Wisdom
|
|