I am using Flutter and dart and I want RegExp to validate strings in the 024648-4568
like format, where a user can only put six numbers at the start, then a -
and then 4 digits at the end.
I started with RegExp(r'^\d{1,6}[\-]?\d{4}')
, but could not fix it for the subsequent dash and 4 digits.
In Flutter, I use it like this:
inputFormatters: [new FilteringTextInputFormatter.allow( RegExp(r'^\d{1,6}-\d{4}') ,]