From 7a601b196eb92953f5b54e2e932d987889ee7b63 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Thu, 29 Jan 2015 13:07:18 -0600 Subject: [PATCH] Fix regex syntax --- lib/linguist/strategy/modeline.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/linguist/strategy/modeline.rb b/lib/linguist/strategy/modeline.rb index 9dbd2dba..7e4fda84 100644 --- a/lib/linguist/strategy/modeline.rb +++ b/lib/linguist/strategy/modeline.rb @@ -23,7 +23,7 @@ module Linguist # # Returns a String or nil def self.modeline(data) - regex = <<-EOF + regex = /(?: (-\*- \s* (?:mode:)? \s*) | # $1: Emacs (\/\* \s* vim: \s* set \s* (?:ft|filetype)=) # $2: Vim @@ -35,7 +35,6 @@ module Linguist : \s* \*\/ # otherwise close Vim syntax ) )/x - EOF data.lines.first(5).any? { |l| l.match(regex) } lang = $3