in reply to How to bold text with regexp...
Broken down:#!/usr/bin/perl -w use strict; my $txt = "foo *text* bar *bat* bounce"; $txt =~ s/\*(.*?)\*/<em>$1<\/em>/g; print $txt."\n";
s/ substitute \* a star (.*?) then a group of arbitrary characters (but only match once, see b +elow) \* then another star / replace it with <em>$1<\/em> what we just got, surrounded by <em>'s /g; do this across the entire string;
Good luck with it. Having MacPerl shouldn't make any difference. --jbfoo <em>text* bar *bat</em> bounce - instead of - foo <em>text</em> bar <em>bat</em> bounce
|
|---|