summaryrefslogtreecommitdiff
path: root/src/regexp/syntax/regexp.go
diff options
context:
space:
mode:
authorTamir Duberstein <tamird@gmail.com>2015-10-20 11:21:21 -0400
committerRuss Cox <rsc@golang.org>2015-11-25 17:25:22 +0000
commit3aa755b8fb82c28e55938e040bdead6b7f45ae5a (patch)
tree9dda43d52b44c8ba9c1ab43fc42ba8422ac1f59c /src/regexp/syntax/regexp.go
parent0b55be1ba2cf1cbb84ef4292942e6532df0b22ad (diff)
downloadgo-git-3aa755b8fb82c28e55938e040bdead6b7f45ae5a.tar.gz
regexp/syntax: correctly print `^` BOL and `$` EOL
Fixes #12980. Change-Id: I936db2f57f7c4dc80bb8ec32715c4c6b7bf0d708 Reviewed-on: https://go-review.googlesource.com/16112 Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/regexp/syntax/regexp.go')
-rw-r--r--src/regexp/syntax/regexp.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/regexp/syntax/regexp.go b/src/regexp/syntax/regexp.go
index cea7d9e04f..75822cf981 100644
--- a/src/regexp/syntax/regexp.go
+++ b/src/regexp/syntax/regexp.go
@@ -166,9 +166,9 @@ func writeRegexp(b *bytes.Buffer, re *Regexp) {
case OpAnyChar:
b.WriteString(`(?s:.)`)
case OpBeginLine:
- b.WriteRune('^')
+ b.WriteString(`(?m:^)`)
case OpEndLine:
- b.WriteRune('$')
+ b.WriteString(`(?m:$)`)
case OpBeginText:
b.WriteString(`\A`)
case OpEndText: