Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/find/matchers/regex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ impl FromStr for RegexType {
"posix-extended" => Ok(Self::PosixExtended),
// ed and sed are the same as posix-basic
"ed" | "sed" => Ok(Self::PosixBasic),
// egrep and posix-egrep are the same as posix-extended
"egrep" | "posix-egrep" => Ok(Self::PosixExtended),
_ => Err(ParseRegexTypeError(s.to_owned())),
}
}
Expand Down Expand Up @@ -222,4 +224,17 @@ mod tests {
let deps = FakeDependencies::new();
assert!(!matcher.matches(&abbbc, &mut deps.new_matcher_io()));
}

#[test]
fn egrep_aliases_map_to_posix_extended() {
// GNU accepts egrep and posix-egrep as names for the extended syntax.
assert_eq!(
"egrep".parse::<RegexType>().unwrap(),
RegexType::PosixExtended
);
assert_eq!(
"posix-egrep".parse::<RegexType>().unwrap(),
RegexType::PosixExtended
);
}
}
Loading