I am trying to configure a regex pattern to add a #
at the end of a string after the second forward slash as follows:
/leisure/venuename/news
=>/leisure/venuename#/news
/leisure/venuename/page/384
=>/leisure/venuename#/page/384
The code below
gsub(/^(.*)(\/.*)$/, '\1#\2')
works as expected for the first pattern, but for the second pattern, it provides this:
/leisure/venuename/page#/384
Is there a way to capture both groups with one pattern?