menu
The test() method of JavaScript executes a search for a match between a regular expression and a specified string. If the match is found, it will return true. Otherwise, it will return false.

export const displayRoute = (route: string, t: (key: string) => string): string => {  
  const accountDetailRegex = /^\/accounts\/[0-9a-fA-F-]{36}$/;
if (accountDetailRegex.test(route)) return t('accountDetails'); };

In this example, we received a route and parsed it in regex to test() to verify whether it matched the possible characters of the routes.