<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <id>tag:www.refactormycode.com,2007:users449</id>
  <link type="application/atom+xml" href="http://www.refactormycode.com/users/449" rel="self"/>
  <title>shtruc</title>
  <updated>Tue Jan 08 22:35:20 -0800 2008</updated>
  <entry>
    <id>tag:www.refactormycode.com,2007:Refactor1424</id>
    <published>2008-01-08T22:35:20-08:00</published>
    <title>[PHP] On Replace user input with link</title>
    <content type="html">&lt;p&gt;If i understand correctly, the idea is to take some user input and create &amp;lt;a&amp;gt; elements for each valid url in it.
&lt;br /&gt;Try this regexp :&lt;/p&gt;

&lt;pre&gt;&amp;lt;?php
$input = preg_replace(&amp;quot;/(www\.|http:\/\/)([^\s]+)/&amp;quot;, '&amp;lt;a href=&amp;quot;http://$1$2&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;$1$2&amp;lt;/a&amp;gt;', $input);
?&amp;gt;&lt;/pre&gt;</content>
    <author>
      <name>shtruc</name>
      <email>supudo@gmail.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/202-replace-user-input-with-link/refactors/1424" rel="alternate"/>
  </entry>
  <entry>
    <id>tag:www.refactormycode.com,2007:Refactor1411</id>
    <published>2008-01-08T13:12:22-08:00</published>
    <title>[JavaScript] On Anti-spam Mailto</title>
    <content type="html">&lt;p&gt;Why bother with arrays. Email hunters will have no difficulties parsing array elements or separated strings. Scrambling the array will be something interesting.&lt;/p&gt;

&lt;pre&gt;function showEMail() {
   document.write('&amp;lt;a href=&amp;quot;mailto:' + 'myemail' + '&amp;amp;#64;' + 'domain' + '.com' + '&amp;quot; &amp;gt;' + 'myemail' + '&amp;amp;#64;' + 'domain' + '.com' + '&amp;lt;/a&amp;gt;');
}&lt;/pre&gt;</content>
    <author>
      <name>shtruc</name>
      <email>supudo@gmail.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/206-anti-spam-mailto/refactors/1411" rel="alternate"/>
  </entry>
</feed>

