use regex::Regex; use crate::SbotCliError; /// Return matches for a given Regex pattern and text. /// /// # Arguments /// /// * `pattern` - A string slice representing a regular expression /// * `input` - A string slice representing the input to be matched on /// pub fn regex_finder(pattern: &str, input: &str) -> Result, SbotCliError> { let re = Regex::new(pattern)?; let caps = re.captures(input); let result = caps.map(|caps| caps[1].to_string()); Ok(result) }