<div class="gmail_quote">2011/6/28 Morten Wang <span dir="ltr">&lt;<a href="mailto:nettrom@gmail.com">nettrom@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>2: Using functions instead of strings as the replacement in sub().  If you&#39;re looking to do a fair amount of conditional logic in your replacement, it might be more easily written by having a function do it, rather than attempt to do it all with a regex.</div>

<div><br></div><div>My $.02.</div></blockquote><div><br>Thank you for this great idea that is worth much more than $.02. :-)<br>I can tell that my problem is completely solved now, much better than I had hoped previously. <br>
I am glad to announce this small guide to functions which is the result of my last two day&#39;s work:<br><a href="http://hu.wikipedia.org/wiki/Szerkeszt%C5%91:Bin%C3%A1ris/Fixes_and_functions_HOWTO">http://hu.wikipedia.org/wiki/Szerkeszt%C5%91:Bin%C3%A1ris/Fixes_and_functions_HOWTO</a><br>
This shows not only an example of a complicated replacement, but also the way to compare the match to the whole article (removing redundant links), or generating a long fix by means of a function. Another example is how to choose between two options for replacement during runtime (when you cannot decide it in coding time without a text environment).<br>
</div></div><br>-- <br>Bináris<br>