I'm trying to create regex to validate all postal and zip codes format. I found an answer for this What is the ultimate postal code and zip regex? but it doesn't work in dart. Here are the criteria from the answer which are exactly what I'm looking for
Every postal code system uses only A-Z and/or 0-9 and sometimes space/dash
Not every country uses postal codes (ex. Ireland outside of Dublin), but we'll ignore that here.
The shortest postal code format is Sierra Leone with NN
The longest is American Samoa with NNNNN-NNNNNN
You should allow one space or dash.
Should not begin or end with space or dash
Here is the regex which I need to convert to dart (?i)^[a-z0-9][a-z0-9\- ]{0,10}[a-z0-9]$