<script>alert( 'vasia(petia grisha) grisha( petia vasia) petia(vasia grisha )' .split(/\s(?![^(]*\))/g) .join('\n'));</script>