Basic regexp implementation