/// Defines the start, end and both bounds of a word
pub enum WordBounds {
None,
Start,
End,
Both,
}
impl WordBounds {
/// Convert word bounds
pub fn to_pattern(&self, word: &str) -> String {
match self {
WordBounds::Start => [r#"\b"#, word].concat(),
WordBounds::End => [word, r#"\b"#].concat(),
WordBounds::Both => [r#"\b"#, word, r#"\b"#].concat(),
_ => word.to_owned(),
}
}
}