3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $postcode = 'SW196QX'; // Validate the postcode if (preg_match( '/^GIR 0AA)|((([A-Z-[QVX]][0-9][0-9]?)|(([A-Z-[QVX]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVX]][0-9][A-HJKPSTUW])|([A-Z-[QVX]][A-Z-[IJZ]][0-9][ABEHMNPRVWXY])))) [0-9][A-Z-[CIKMOV]]{2})$/', $postcode ) === 1) { echo 'Invalid'; } else { echo 'Valid'; }
Output for 7.0.20, 7.1.5 - 7.2.0
Warning: preg_match(): Compilation failed: unmatched parentheses at offset 8 in /in/eqdsr on line 8 Valid
Output for 7.0.0 - 7.0.6, 7.1.0
Warning: preg_match(): Compilation failed: unmatched parentheses at offset 8 in /in/eqdsr on line 7 Valid
Output for 5.3.18 - 5.6.28
Warning: preg_match(): Compilation failed: unmatched parentheses at offset 8 in /in/eqdsr on line 9 Valid