Browse Source

Use lazy front-matter regex

Using a greedy regex could lead to unintended consequences, like the
inability to syntax highlight a unified diff. This resolves issues like
that by using .*? instead of .* so that the closing +++ is matched as
soon as possible.
index-subcmd
Reilly Tucker Siemens 7 years ago
parent
commit
7c1cecb211
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      src/front_matter.rs

+ 1
- 1
src/front_matter.rs View File

@@ -11,7 +11,7 @@ use errors::{Result, ResultExt};


lazy_static! {
static ref PAGE_RE: Regex = Regex::new(r"^\n?\+\+\+\n((?s).*(?-s))\+\+\+\n?((?s).*(?-s))$").unwrap();
static ref PAGE_RE: Regex = Regex::new(r"^\n?\+\+\+\n((?s).*?(?-s))\+\+\+\n?((?s).*(?-s))$").unwrap();
}




Loading…
Cancel
Save