Hey guys,
I been doing alot of research on regex yet I am still not sucessful at extracting a domain name, directory name, file name out of a string in this format using regex's. (Im new to perl)
Can someone show me how this could be done? http:// will always be at the start of the line although the format of $url can change from to to
Any help would be greatly appreciated!
I been doing alot of research on regex yet I am still not sucessful at extracting a domain name, directory name, file name out of a string in this format using regex's. (Im new to perl)
Can someone show me how this could be done? http:// will always be at the start of the line although the format of $url can change from to to
Any help would be greatly appreciated!
Code:
$domain
[URL unfurl="true"]http://123.domain.123/Dir/file.ext?&=(or[/URL] invalid chars)
^^^^^^^--------------^ $domain triggers upto first /
??? $url =~ s/^(http:\/\/*?\/)/i;
$directory
[URL unfurl="true"]http://123.domain.123/Dir/file.ext?&=(or[/URL] invalid chars)
Directory triggers ^---^ if present without ^
$file or anything after $domain.$directory
[URL unfurl="true"]http://123.domain.123/Dir/file.ext?&=(or[/URL] invalid chars)
File triggers ^----^---^^^~>