I'm making a Wakaba image board using the perl script I can download. However one thing that has perplexed me is the function "expand_filename($)" which will expand the path of the filename.
Everything, on all files, including my images, it would add /~ponydash/ to the end, ponydash is the name of my account on the hosting, so I created a debug function to see what it would return, it is as follows:
sub debug_string()
{
my ($filename)=@_;
return $filename if($filename=~m!^/!);
return $filename if($filename=~m!^\w+:!);
my ($self_path)=$ENV{SCRIPT_NAME}=~m!^(.*/)[^/]+$!;
return $self_path;
}
And when called in the HTML document with
<var debug_string()>
It would return:
/~ponydash/b/
Now I want to know how I could modify the third to last line to remove the /~ponydash/ part to just leave /b/.
This should return only the second path part to the end of the path:
^\/[^\/]*(\/.*)$
The first / and all preceding non-slash characters are ignored up to the second slash which will be captured like the rest of the string.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.