- or download this
#!/usr/bin/perl -w
...
$txt =~ s/\*(.*?)\*/<em>$1<\/em>/g;
print $txt."\n";
- or download this
s/ substitute
\* a star
...
/ replace it with
<em>$1<\/em> what we just got, surrounded by <em>'s
/g; do this across the entire string;
- or download this
foo <em>text* bar *bat</em> bounce
- instead of -
foo <em>text</em> bar <em>bat</em> bounce