trim function doesn't do what you think it does, although it would be nice if it did.
There are other ways to accomplish the task. The URL Toolkit app will parse the URL for you and let you choose any part(s) you like.
rex command can do it, too.
... | rex field=url "(?<url>.*)\/"