The regex looks awful with asterisks in it, so we compile it and only have to look at it once.
Modify the substitute string to taste.use CGI qw/:standard/; my $stars = qr/\*([^*]*)\*/s; local $_ = 'Hi there *mom* and *dad*'; s/$stars/i($1)/eg; print;
Update: Thanks to bart and other CBers for the spot, had a s/// flag hanging off the regex instead. Repaired.
After Compline,
Zaxo
In reply to Re: Another regex needed
by Zaxo
in thread Another regex needed
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |