in reply to negative regex without !~

To match strings not containing foo how about qr/^(?:[^f]|f[^o]|fo[^o])*(?:f|fo)?$/ ?

Edited by Chady -- code tags.