in reply to How to bold text with regexp...

No real need to use nested *'s. Remember that the * character can be "greedy" in a regular expression, meaning that it finds more than one possibility, and will take the last one it gets. I used this:
#!/usr/bin/perl -w use strict; my $txt = "foo *text* bar *bat* bounce"; $txt =~ s/\*(.*?)\*/<em>$1<\/em>/g; print $txt."\n";
Broken down:
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;


What .*?\* will do for you is match all characters for you before a star, but the ? tells it to stop matching after the first possibility. Without it, your output would look like
foo <em>text* bar *bat</em> bounce - instead of - foo <em>text</em> bar <em>bat</em> bounce
Good luck with it. Having MacPerl shouldn't make any difference.     --jb