Regexp -> if condition corrected