Add s flag to make . match newline

This commit is contained in:
crides 2019-07-24 09:41:22 +08:00
parent 860824b88d
commit 1a622ce1fd
2 changed files with 4 additions and 0 deletions

View file

@ -29,6 +29,7 @@ pub(crate) struct Options {
c - case-sensitive c - case-sensitive
i - case-insensitive i - case-insensitive
m - multi-line matching m - multi-line matching
s - make `.` match newlines
w - match full words only w - match full words only
*/ */

View file

@ -54,6 +54,9 @@ impl Replacer {
'm' => { 'm' => {
regex.multi_line(true); regex.multi_line(true);
} }
's' => {
regex.dot_matches_new_line(true);
}
'w' => { 'w' => {
regex = regex::bytes::RegexBuilder::new(&format!( regex = regex::bytes::RegexBuilder::new(&format!(
"\\b{}\\b", "\\b{}\\b",