Improve regexp

Avoid calling the static method at each iteration