@ilex01 the $ character at the end of the regex checks that the match must be at the end of the string. In this case, the regex is checking if /recent is the last thing in the URL if so the page will be scrolled to the element with id #anchor2
ok i tested it is not valid
window.location.href.match(/\/recent$/)
change it to this u should match recent at the and of a string
@ilex01 also if u want to test regex u can just go here and test them to understand if they are valid and match what u are looking for
https://regex101.com/