SafeSend Interview Question

How to match a pattern in a string