Regex on Server Side

Hi in a recent(ish) thread I was looking for a way to extract an ID and I received great help on how to do it here Extract an ID using regex. However, something that I really needed was for there to be regex server side. Is it possible to add in regex on the server-side rather than just on the app connect? Having Regex on the server-side enables us to ensure the data is in the correct format and not susceptible to data manipulation client side that could break certain features etc.

Thanks