
跃然一笑
123456789101112131415let regex = /^((a|file)\(.+\)|(img|aduio|video))\[.+]$/i; test('should test ok',()=>{ let regex = /^((a|file)\(.+\)|(img|aduio|video))\[.+]$/i; expect(regex.test('file(a)[b]')).toBe(true); expect(regex.test('file[b]')).toBe(false); expect(regex.test('file(b)')).toBe(false); expect(regex.test('a(a)[b]')).toBe(true); expect(regex.test('img[c]')).toBe(true); expect(regex.test('aduio[e]')).toBe(true); expect(regex.test('video[e]')).toBe(true); expect(regex.test('video(d)[e]')).toBe(false); expect(regex.test('aduio(d)[e]')).toBe(false); expect(regex.test('img(d)[e]')).toBe(false);})