|
|
|
@ -148,11 +148,12 @@ class HackUserLastestCodesController < ApplicationController
|
|
|
|
|
# 正则错误行数
|
|
|
|
|
def regular_match_error_line content, language
|
|
|
|
|
content = Base64.decode64(content).force_encoding("utf-8")
|
|
|
|
|
logger.info("######content: #{content}")
|
|
|
|
|
case language
|
|
|
|
|
when 'Java'
|
|
|
|
|
content.scan(/.java.\d+/).map{|s| s.match(/\d+/)[0].to_i}.min
|
|
|
|
|
when 'C', 'C++'
|
|
|
|
|
content.scan(/\d:\d+: error/).map{|s| s.match(/\d+/)[0]}.min
|
|
|
|
|
content.scan(/\d:\d+:/).map{|s| s.match(/\d+/)[0]}.min
|
|
|
|
|
when 'Python'
|
|
|
|
|
content.scan(/line \d+/).map{|s| s.match(/\d+/)[0].to_i}.min
|
|
|
|
|
end
|
|
|
|
|