I have this regex that I want to use to parse a UK postcode, but it doesn't work when a postcode is entered without spaces.
^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]?) {1,2}([0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$
What change(s) do I need to make to this regex so it'll work without spaces correctly?
If I supply LS28NG
I would expect the regex to return two matches for LS2
and 8NG
.