Imagine you implement a web service to pay for video games. There is a text field where a user inputs their card number. A card number is a string like "AAAA AAAA AAAA AAAA", where A is any digit. Please note that a correct card number contains three spaces as in the template. Complete the function that receives a card number as a string and returns the card number as a Long or produces any exception when the card number is incorrect.
Tip: You may use regular expressions to solve this task quickly. You can read about them here.