Fixes regex logic