hi deane --
In a message dated 2/12/2008 3:05:23 P.M. Eastern Standard Time,
[EMAIL PROTECTED] writes:
> Hi, all.
>
> I'm having a relatively simple problem, trying to trim stuff
> off the end of a URL.
>
> INPUT:
> _http://www.wilbert.net_ (http://www.wilbert.net)
> _www.worful.com/after-text.htm_ (http://www.worful.com/after-text.htm)
> _http://www.winston.com/argle.htm_ (http://www.winston.com/argle.htm)
> _www.windoze.net_ (http://www.windoze.net)
>
> DESIRED OUTPUT:
> _http://www.wilbert.net_ (http://www.wilbert.net)
> _www.worful.com_ (http://www.worful.com)
> _http://www.winston.com_ (http://www.winston.com)
> _www.windoze.net_ (http://www.windoze.net)
how about
perl -wMstrict -e
"my $trim = qr{ (?<! : | /) / .* $ }xms; print qq(\n);
for (@ARGV) { s{ $trim }{}xms; print qq($_ \n); }
"
_http://www.wilbert.net_ (http://www.wilbert.net)
_www.worful.com/after-text.htm_ (http://www.worful.com/after-text.htm)
_http://www.winston.com/argle.htm_ (http://www.winston.com/argle.htm)
_www.windoze.net_ (http://www.windoze.net)
_http://www.wilbert.net_ (http://www.wilbert.net)
_www.worful.com_ (http://www.worful.com)
_http://www.winston.com_ (http://www.winston.com)
_www.windoze.net_ (http://www.windoze.net)
hth -- bill walters
**************The year's hottest artists on the red carpet at the Grammy
Awards. Go to AOL Music.
(http://music.aol.com/grammys?NCID=aolcmp00300000002565)
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs