In Custom Profile Fields the Input Mask can be set to 'Regex (Advanced)', which then allows you to enter a regular expression that you would like to use to validate that profile field. However, the regex that you enter must be delimited by special characters. If you simply enter a regex, like this:
[12][0-9]{3}
it doesn't work. Even worse, it fails silently, acting as though any data that was entered is matched by the regex.
If you enter the regex surrounded by tildes, as shown by [emanuele], or like this:
~[12][0-9]{3}~
then it works as expected. Double quotes also work as delimiters.
Tested in SMF 2.0.4.