How to do the match in jquery?

eg: there is a url as this:

http://example.com

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=http://example.com/test/…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.