Regular expression checking of landline/mobile UK numbers in Ruby on Rails

You want to have validations for phone numbers in Ruby on Rails code.

The mobile numbers in UK should start with a 0, followed by 7, then a number between 5 and 9, and finally another 8 numbers.
For the landline numbers in UK the number should start with 0, followed by either 1 and 8 or 9 digits, or by 2 or 3 and then 9 digits.
So in order to use a regular expression in your validations, you could use something like the following in your model: