How to do the match in jquery?

eg: there is a url as this:

i want to make a match that the second part in the url are beginning of test. then do something.
eg: if the url is IANA — Example domains or [url=…then]IANA — Example domains

thank you.

The standard location object contains that information, so location.pathname will be the path part of what you want.