diff --git a/compile.go b/compile.go index 7d05781..8d49419 100644 --- a/compile.go +++ b/compile.go @@ -77,6 +77,9 @@ func getPOSIXClass(str []rune) (bool, string) { // Stores whether the case-insensitive flag has been enabled. var caseInsensitive bool +// Stores whether the multiline flag has been enabled. +var multilineMode bool + /* The Shunting-Yard algorithm is used to convert the given infix (regeular) expression to postfix. The primary benefit of this is getting rid of parentheses. @@ -89,9 +92,11 @@ func shuntingYard(re string, flags ...ReFlag) ([]postfixNode, error) { // Check which flags are enabled caseInsensitive = false + multilineMode = false // In Multiline mode, the newline character is considered a // 'dot' character ie. the dot metacharacter matches a newline as well. if slices.Contains(flags, RE_MULTILINE) { + multilineMode = true notDotChars = []rune{} } else { notDotChars = []rune{'\n'}