Have you gone through our support article Restricting Text Responses With Regular Expressions? It should help you achieve what you are looking for.
In addition, you could also have a look to our practical workarounds that has been discussed previously in the community here.