Initial commit
This commit is contained in:
		
							
								
								
									
										22
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
# Postal Dataset
 | 
			
		||||
 | 
			
		||||
This is a dataset for noccylabs/dataset holding postal code patterns for
 | 
			
		||||
validating postal codes.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Datasets
 | 
			
		||||
 | 
			
		||||
### postalcode
 | 
			
		||||
 | 
			
		||||
Field | Type | Description
 | 
			
		||||
---|---|---
 | 
			
		||||
`iso` | string | The ISO 2-letter country code
 | 
			
		||||
`format` | array | Valid formats, see below
 | 
			
		||||
`regex` | string | Unguarded regex to validate against
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
- The value in `format` is treated literal, except for the following characters:
 | 
			
		||||
  `#` indicates a number, `?` indicates a digit, and `*` indicates either a number
 | 
			
		||||
  or digit.
 | 
			
		||||
- The regex must be bounded, for example as `"<^".$regex."$>"`. This is done so
 | 
			
		||||
  that multiple expressions can be combined easily.
 | 
			
		||||
							
								
								
									
										8
									
								
								composer.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								composer.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
{
 | 
			
		||||
    "name": "noccylabs/dataset-postal",
 | 
			
		||||
    "description": "Dataset containing postal code validation patterns",
 | 
			
		||||
    "license": "CC-BY-SA-4.0",
 | 
			
		||||
    "suggest": {
 | 
			
		||||
        "noccylabs/dataset": "to parse the dataset"
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										47
									
								
								data/postalcodes.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								data/postalcodes.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "iso": "se",
 | 
			
		||||
    "format": [ "??? ??", "?????" ],
 | 
			
		||||
    "regex": "(\d{3}\s{0,1}\d{2})"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "iso": "no",
 | 
			
		||||
    "format": [ "????" ],
 | 
			
		||||
    "regex": "(\d{4})"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "iso": "dk",
 | 
			
		||||
    "format": [ "????", "DK-????" ],
 | 
			
		||||
    "regex": "((DK-){0,1}\d{4})"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "iso": "fi",
 | 
			
		||||
    "format": [ "?????", "FI-?????" ],
 | 
			
		||||
    "regex": "((FI-){0,1}\d{5})"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "iso": "ax",
 | 
			
		||||
    "format": [ "?????", "AX-?????" ],
 | 
			
		||||
    "regex": "((AX-){0,1}\d{5})"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "iso": "es",
 | 
			
		||||
    "format": [ "?????", "EE-?????" ],
 | 
			
		||||
    "regex": "((EE-){0,1}\d{5})"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "iso": "lv",
 | 
			
		||||
    "format": [ "##-????" ],
 | 
			
		||||
    "regex": "([a-z]{2}-\d{4})"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "iso": "lt",
 | 
			
		||||
    "format": [ "##-?????" ],
 | 
			
		||||
    "regex": "([a-z]{2}-\d{5})"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "iso": "pl",
 | 
			
		||||
    "format": [ "??-???" ],
 | 
			
		||||
    "regex": "(\d{2}-\d{3})"
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
							
								
								
									
										7
									
								
								dataset.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								dataset.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "datasets": {
 | 
			
		||||
    "postalcodes": {
 | 
			
		||||
      "filename": "data/postalcodes.json"
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user