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

Hi, in the absence of modules the following regexp seems to work. It will need changing if you're going to somehow allow literal *'s in the text, but I'd need to know how you intend to do this really before being able to do it.

Just for further information the secret is in the ? which forces minimal, ie. 'shortest possible', matching.

#!/usr/bin/perl -w use strict; my $text = "This is in *Bold* and so is *This*!"; $text =~ s/\*(.*?)\*/<em>$1<\/em>/g; print $text;