ApiSandbox broken because of undefined variable

"TypeError: match is undefined". Ouch.

Also changed a regex a bit to avoid horrible backtracking.

Bug: 64047
Change-Id: Idf10ddfb0cca2d8c5fe91b8b5e582adba8b48824