summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 050ed52..41a914c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1026,8 +1026,8 @@ pub mod str {
}
}
- pub fn regex<'a>(pattern: &'a str) -> impl Parser<&'a str, Output = &'a str> {
- Regex(regex::Regex::new(pattern).unwrap())
+ pub fn regex<'a>(regexp: regex::Regex) -> impl Parser<&'a str, Output = &'a str> {
+ Regex(regexp)
}
}
@@ -1050,7 +1050,7 @@ mod test {
fn test_regex_parser() {
let it = InputIter::new("abc 123");
- match crate::str::regex("[abc]+").parse(it) {
+ match crate::str::regex(regex::Regex::new("[a-z]+").unwrap()).parse(it) {
Ok((rest, output)) => {
assert_eq!(output, "abc");
assert_eq!(rest.rest(), " 123");