JavaScript: match();

Thanks to Open Source Hacker for the help with the match() function. Worked really well! There’s probably a better way to write this but I made a frankenstein out of somebody else’s JavaScript. How would you do it? EDIT: I know popup alerts are so 1999, but this was a client request.