Posted on 2002-03-13
I'm working on a simple templating system, don't want to use the perlmod for it, but I'm having trouble with this regex...
I want to take tags of the form
and put them as
this is the basic version:
$url = "view.cgi?page=";
$content =~ s/\[\[(.*?)\]\]/$url$1/g;
but I'd like to do relative links as well, so that
(assume the current dir is in $currentdir )
in short, I want to say "if $1 doesn't contain a / then prepend it with currentdir/" in my original substitution but I don't know how...