Skip to content

Commit

Permalink
Let ^$ match lines by default
Browse files Browse the repository at this point in the history
resolves #60
  • Loading branch information
chmln committed Jan 25, 2020
1 parent 4d27421 commit 87491b4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
25 changes: 13 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ repository = "https://github.com/chmln/sd.git"
categories = ["command-line-utilities", "text-processing", "development-tools"]

[dependencies]
regex = "1.3.1"
structopt = "0.3.7"
regex = "1.3.3"
structopt = "0.3.8"
rayon = "1.3.0"
unescape = "0.1.0"
memmap = "0.7.0"
Expand All @@ -24,7 +24,7 @@ thiserror = "1.0.9"
assert_cmd = "0.12.0"

[build-dependencies]
structopt = "0.3.7"
structopt = "0.3.8"
man = "0.3.0"

[profile.release]
Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pub enum Error {
#[error("invalid regex {0}")]
Regex(#[from] regex::Error),
#[error("{0}")]
#[error(transparent)]
File(#[from] std::io::Error),
#[error("failed to move file: {0}")]
TempfilePersist(#[from] tempfile::PersistError),
Expand Down
4 changes: 3 additions & 1 deletion src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@ impl Replacer {
};

let mut regex = regex::bytes::RegexBuilder::new(&look_for);
regex.multi_line(true);

if let Some(flags) = flags {
flags.chars().for_each(|c| {
#[rustfmt::skip]
match c {
'c' => { regex.case_insensitive(false); },
'i' => { regex.case_insensitive(true); },
'm' => { regex.multi_line(true); },
'm' => {},
'e' => { regex.multi_line(false); },
's' => { regex.dot_matches_new_line(true); },
'w' => {
regex = regex::bytes::RegexBuilder::new(&format!(
Expand Down

0 comments on commit 87491b4

Please sign in to comment.