fix javascript pattern