Added tests for matchesRegex function