Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'ts been way too long since the last time I did this, but I have text that looks like:
*this*in a string, and I want to change it to:
<em>this</em>I tried:
$text =~ s\*(.{1,})\*/<em>$1<\/em>/g;but the matched text tends to keep going past the second "*". I *think* I need to change the "." into a range of some sort, excluding the * character. I'm not terribly worried about nested *'s, and I'm using MacPerl so I'm pretty much unable to use HTML modules that might do this for me. Anyone have some ideas what I'm doing wrong?
- Brad
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to bold text with regexp...
by JayBonci (Curate) on Apr 24, 2002 at 08:43 UTC | |
|
Re: How to bold text with regexp...
by stephen (Priest) on Apr 24, 2002 at 08:40 UTC | |
by thelenm (Vicar) on Apr 24, 2002 at 14:58 UTC | |
|
Re: How to bold text with regexp...
by Molt (Chaplain) on Apr 24, 2002 at 08:46 UTC | |
|
Re: How to bold text with regexp...
by Anonymous Monk on Apr 24, 2002 at 18:33 UTC |