Regexps are bad. Hail the strcspn :)