we don't need to create a new object each time so please move `new RegExp()` to outside and re-use it.