Question: I have list of codes which are separated by comma, the code contains min of 3 and max of 6 characters including numbers. I have written regex for this. How can I expand my regex to work with 1 or more codes as array or list?

Here is my regex for codes

```
const checkCodes = new RegExp('^[A-Z]+[A-Z0-9]{2,5}$');

```

The above regex works well with single codes

```
codes - "BCD"

```

but not for below line, which I am trying to achieve

```
codes - ["BCD", "VOC123",....1 or more codes]

```

Answer: 
```js
const checkCodes = new RegExp('^[A-Z]+[A-Z0-9]{2,5}$');

let input = ["CODE1", "NOT.A.CODE", "CODE42"];

console.log(input.filter(str => checkCodes.test(str)))

```
```js

const checkCodesMulti = /^([A-Z]+[A-Z0-9]{2,5})(?:\s*,\s*([A-Z]+[A-Z0-9]{2,5}))*$/

let input = "BCD, VOC123, ETC";
let array_of_codes = checkCodesMulti.exec(input).splice(1)

```