M
mitch
Hi folks,
I am working on a what I thought would be fairly simple regular
expression search. I am simply trying to take a full URL (something
like http://www.someurl.com/someDir/file.html) and parse it out into
its components domain and path (domain = www.someurl.com & path =
/someDir/file.html). So I wrote this little script to do just that.
However, I am getting an error when I run my script and I think it has
something to do with my regex function that I am using. So here is the
code snippet of the offending line:
if ($externalLink =~ m/http:\/\/([^\/]+)/) {
$domain = $1;
$path = $';
}
The error that I am getting is this:
Missing right bracket at ./LogPreProcessor_Inetprod.pl line 64, at end
of line
syntax error at ./LogPreProcessor_Inetprod.pl line 64, at EOF
Execution of ./LogPreProcessor_Inetprod.pl aborted due to compilation
errors.
I also tried to modify the script by removing the \ from within the
square brackets:
if ($externalLink =~ m/http:\/\/([^/]+)/) {
$domain = $1;
$path = $';
}
But that too gives me an error:
bash-2.03$ LogPreProcessor_Inetprod.pl inet.log
/http://([^/: unmatched [] in regexp at ./LogPreProcessor_Inetprod.pl
line 26.
bash-2.03$
So I tried a bunch of other variations, wich also did not work. After
consulting several books and googling for some solution, I thought that
I had exhausted all my research possibilities and I thought that the
smart folks in this group could show me the error of my ways.
On a side note, when I used the following search term in google to look
for a solution:
Perl "[^/]"
Google seemed to ignore all those special characters, and simply
returned any page that contained the term 'Perl'. So that was useless.
Thanks for all your help in this matter.
Regards,
Mitch
I am working on a what I thought would be fairly simple regular
expression search. I am simply trying to take a full URL (something
like http://www.someurl.com/someDir/file.html) and parse it out into
its components domain and path (domain = www.someurl.com & path =
/someDir/file.html). So I wrote this little script to do just that.
However, I am getting an error when I run my script and I think it has
something to do with my regex function that I am using. So here is the
code snippet of the offending line:
if ($externalLink =~ m/http:\/\/([^\/]+)/) {
$domain = $1;
$path = $';
}
The error that I am getting is this:
Missing right bracket at ./LogPreProcessor_Inetprod.pl line 64, at end
of line
syntax error at ./LogPreProcessor_Inetprod.pl line 64, at EOF
Execution of ./LogPreProcessor_Inetprod.pl aborted due to compilation
errors.
I also tried to modify the script by removing the \ from within the
square brackets:
if ($externalLink =~ m/http:\/\/([^/]+)/) {
$domain = $1;
$path = $';
}
But that too gives me an error:
bash-2.03$ LogPreProcessor_Inetprod.pl inet.log
/http://([^/: unmatched [] in regexp at ./LogPreProcessor_Inetprod.pl
line 26.
bash-2.03$
So I tried a bunch of other variations, wich also did not work. After
consulting several books and googling for some solution, I thought that
I had exhausted all my research possibilities and I thought that the
smart folks in this group could show me the error of my ways.
On a side note, when I used the following search term in google to look
for a solution:
Perl "[^/]"
Google seemed to ignore all those special characters, and simply
returned any page that contained the term 'Perl'. So that was useless.
Thanks for all your help in this matter.
Regards,
Mitch