JSFiddle - React, Tailwind, and code Playground

ZIP / POSTCODE check

by Andrew Pougher

HTML

<div id="andrew">NR242HP</div>

JavaScript

var isPostcode = $('#andrew').text().match(/[A-Z]{1,2}[0-9][0-9A-Z]?\s?[0-9][A-Z]{2}/gi);
if(isPostcode){alert(isPostcode)}else{alert("its a fkn Zip mate!!")};