'Flutter how to validate any ssn using RegExp

I want to validate my ssn using FilteringTextInputFormatter.allow(RegExp()),

I want it to start with 1 or 2 with 10 length and last 9th numbers any number ,only first one should be 1 or 2



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source