java add forward / at the end of not present code example
Example: java add forward / at the end of not present
const regex = new RegExp("^(/[a-z0–9/_\-]*)");
console.log("/newsgjgjgj".replace(regex, "$1/"));
console.log("/news?param1=value1".replace(regex, "$1/"));
console.log("/news#anchor?param1=value1".replace(regex, "$1/"));