[][src]Function librelic::prelude::sys::extract_strings_p

pub fn extract_strings_p<T, U>(
    path: T,
    rx: U
) -> Result<Vec<String, Global>, FuError> where
    T: AsRef<Path>,
    U: AsRef<str>, 

Returns the captured strings from the given regular expression rx.

Examples

use fungus::prelude::*;

let tmpdir = PathBuf::from("tests/temp").abs().unwrap().mash("file_doc_extract_strings_p");
assert!(sys::remove_all(&tmpdir).is_ok());
let tmpfile = tmpdir.mash("file1");
assert!(sys::mkdir(&tmpdir).is_ok());
assert!(sys::write(&tmpfile, "Not my favorite movie: 'Citizen Kane' (1941).").is_ok());
assert_eq!(sys::extract_strings_p(&tmpfile, r"'([^']+)'\s+\((\d{4})\)").unwrap(), vec!["Citizen Kane", "1941"]);
assert!(sys::remove_all(&tmpdir).is_ok());