On Thursday 31 January 2002 04:56 pm, Dave Hodgkinson wrote:
> Silly one I can't get my head round. I'm trying to strip the uploaded
> file's path off:
>
> [% f2 = upload.filename.replace('/(.+)$','$1') %]
>
> Any offers?
Probably better off doing it prior to passing to the template. Reason being
is that the replace sub will interpret the '$1' in your case as literal. Even
if you double quote it it gets immediately interpreted most likely as an
empty string. Escaping the '$' won't work either. I've tried many ways to
achieve the above with no luck.
Basically both parameters get dropped directly into a regex like:
$var =~ s/$param1/$param2/g; # If I remember correctly
Shay