added amo editor code

AMO editors rejected the code for having performance issues, they gave me a way to do it with regex voodoo and so here is the replacement code. Thanks Mozilla!