2

We have confluence docs portal where we use the Scroll Viewport plugin. This plugin uses Velocity as a template language. I need to get, that highlighted, string from a URL. I already read this article on SO but it does not work for me. I tried it with using regex because I thought is the best solution.

www.servename.com/home/display/DOCMS/Tracking+Data+and+System+Errors

What I did so far:

 #set($regex = "s/.*\/\/.*\/.*\/.*\/\(.*\)\/.*/\1/")
 #set($url = $result.absoluteLink)
 #set($spaceName = $url.replaceAll($regex, ""))
 $spaceName
Community
  • 1
  • 1
Martin Jinda
  • 488
  • 10
  • 26
  • For starters, your regex requires the protocol portion of the uri, followed by a //. Not sure if that is your ultimate answer, and I was looking something similar. Also, I think you need to reference the () portion as your second argument to the replaceAll($regex, "$1") – TWitt Aug 16 '21 at 18:00

0 Answers0