so what I want to do is remove everything after and including the first “/” to appear after a “.”
so: http://linux.pacific.net.au/primary.xml.gz
would become: http://linux.pacific.net.au
How do I do this using regex? The system I’m running on can’t use URI tool.
I suggest you use
URI::Splitwhich will separate a standard URL into its constuent parts for you and rejoin them. You want the first two parts – the scheme and the host.output
Update
If your comment The system I’m running on can’t use URI tool means you can’t install modules, then here is a regular expression solution.
You say you want to remove everything after and including the first “/” to appear after a “.”, so
/^.*?\./finds the first dot, andm|[^/]+|finds everything after it up tot he next slash.The output is identical to that of the preceding code