Added regex and subdir check