<?php
$string = "aa | bb | \"cc | dd\" | 'ee | ff'";
$pattern = '~([\'"]).*?\1(*SKIP)(*FAIL)|\s*\|\s*~';
?>
PD9waHAKCiRzdHJpbmcgPSAiYWEgfCBiYiB8IFwiY2MgfCBkZFwiIHwgJ2VlIHwgZmYnIjsKCiRwYXR0ZXJuID0gJ34oW1wnIl0pLio/XDEoKlNLSVApKCpGQUlMKXxccypcfFxzKn4nOwoKJHNwbGl0dGVkID0gcHJlZ19zcGxpdCgkcGF0dGVybiwgJHN0cmluZyk7CnByaW50X3IoJHNwbGl0dGVkKTsKPz4=