[ create a new paste ] login | about

Link: http://codepad.org/3I1xVo46    [ raw code | output | fork | 4 comments ]

PHP, pasted on Sep 12:
1
2
3
4
5
6
<?php

$markdown = "[I'm an inline-style link](https://www.google.com)";
$html = preg_replace('/\[([^\]]+)\]\(([^\)]+)\)/', '<a href="\2">\1</a>', $markdown);

echo $html;


Output:
1
<a href="https://www.google.com">I'm an inline-style link</a>


Create a new paste based on this one


Comments:
posted by &lt;script&gt;alert(1)&lt;/script&gt; on Dec 9
aa
reply
posted by &lt;script&gt;alert(1)&lt;/script&gt; on Dec 9
<a></a>
reply
posted by &lt;script&gt;alert(1)&lt;/script&gt; on Dec 9


<a href="https://www.google.com">I'm an inline-style link</a>


reply
posted by &lt;script&gt;alert(1)&lt;/script&gt; on Dec 9


<a href="javascript:alert(1)">I'm an inline-style link</a>


reply