$str = "This is a string which has bi-weekly data"; if ($str =~ /(\w+)[- ](daily|month|days|weekly|week)/) { $found= $1; } print $found