[ create a new paste ] login | about

Link: http://codepad.org/eU0OcsFY    [ raw code | output | fork ]

PHP, pasted on Jun 15:
1
2
3
4
5
6
<?php
$str = 'This is a *random* text, with some *bold* markup';

$bold_str = preg_replace('/\*(.*?)\*/','<strong>\\1</strong>',$str);

echo $bold_str;


Output:
1
This is a <strong>random</strong> text, with some <strong>bold</strong> markup


Create a new paste based on this one


Comments: