<?php
echo preg_match('/a(a|aa)+b/', str_repeat('a', 1000000000));