Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion vgrep.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ func (v *vgrep) getGrepType() (grepType string) {
out, _ := v.runCommand([]string{"grep", "--version"}, "")
versionString := out[0]
// versionString = "grep (BSD grep) 2.5.1-FreeBSD"
versionRegex := regexp.MustCompile(`\(([[:alpha:]]+) grep\)`)
// versionString = "grep (BSD grep, GNU compatible) 2.6.0-FreeBSD"
versionRegex := regexp.MustCompile(`\(([[:alpha:]]+) grep`)
// versionRegex matches to ["(BSD grep)", "BSD"], return "BSD"
grepType = versionRegex.FindStringSubmatch(versionString)[1]
return
Expand Down