Some time ago, Dave Cross said:
Why bother wrestiling with complex regular expressions when someone
else has already done the work? Perl has a URI module ("yum install
perl-URI") which understands how URIs (and URLs) work. I'd recommend
using that.
use URI;
my $url = URI->new('http://somesite.
On 16 August 2012 16:28, Lázaro Morales wrote:
> Hello folks,
>
> This question is a bit off-topic but the Fedora Community is awesome. This
> is the question, How can I from this string:
>
>my $url = "http://somesite.org/somefile.zip";;# Example URL
>
> obtain only this sub-string:
>
>
On 08/16/2012 11:28 AM, Lázaro Morales wrote:
Hello folks,
This question is a bit off-topic but the Fedora Community is awesome.
This is the question, How can I from this string:
my $url = "http://somesite.org/somefile.zip";; # Example URL
obtain only this sub-string:
my $file = "somefile.zip
On Thu, Aug 16, 2012 at 9:09 AM, Lázaro Morales wrote:
> Some time ago, Chris Adams said:
>
> Of course, being perl, there's more than one way to do it.
>> I would do something like:
>> my ($file) = $url =~ m!^http://[^/]+/(.*)!;
>> That would strip off the leading protocol/host, leaving the re
Some time ago, Chris Adams said:
Of course, being perl, there's more than one way to do it.
I would do something like:
my ($file) = $url =~ m!^http://[^/]+/(.*)!;
That would strip off the leading protocol/host, leaving the rest. If
there was a subdirectory in the URL (e.g. http://host/some/fi
Some time ago, Boris Epstein said:
Lazaro,
I don't remember all the details of how you'd do it but I believe you can
use the split() function to split the string and then find the last member
of the resulting array.
Good luck!
Boris.
Thanks Boris and Craig,
Using the split function I get this
Once upon a time, Lázaro Morales said:
> Hello folks,
>
> This question is a bit off-topic but the Fedora Community is awesome. This
> is the question, How can I from this string:
>
>my $url = "http://somesite.org/somefile.zip";;# Example URL
>
> obtain only this sub-string:
>
> my
substr($orig, start, numbytes), see also index(str, "searchstr");
On Thu, Aug 16, 2012 at 8:28 AM, Lázaro Morales wrote:
> Hello folks,
>
> This question is a bit off-topic but the Fedora Community is awesome. This
> is the question, How can I from this string:
>
>my $url =
> "http://somesi
Lazaro,
I don't remember all the details of how you'd do it but I believe you can
use the split() function to split the string and then find the last member
of the resulting array.
Good luck!
Boris.
On Thu, Aug 16, 2012 at 11:28 AM, Lázaro Morales wrote:
> Hello folks,
>
> This question is a b