From 86682812d8eb0a0735a21b46f0e1314a27217e35 Mon Sep 17 00:00:00 2001 From: MrRJ45 Date: Sun, 6 Sep 2015 10:00:02 +0100 Subject: Fix Regex Warning Fixing Regex Warning on Console: /var/lib/gems/2.1.0/gems/oxidized-0.7.2/lib/oxidized/model/routeros.rb:10: warning: nested repeat operator '+' and '?' was replaced with '*' in regular expression: /\[(?:\d+)?(/ --- lib/oxidized/model/routeros.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/oxidized') diff --git a/lib/oxidized/model/routeros.rb b/lib/oxidized/model/routeros.rb index 3ee40fc..4822500 100644 --- a/lib/oxidized/model/routeros.rb +++ b/lib/oxidized/model/routeros.rb @@ -7,7 +7,7 @@ class RouterOS < Oxidized::Model end cmd '/export' do |cfg| - cfg.gsub! /\[(?:\d+)?(?:;\d+)?(?:m)?/, '' # strip ANSI colours + cfg.gsub! /\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]/, '' # strip ANSI colours cfg = cfg.split("\n").select { |line| not line[/^\#\s\w{3}\/\d{2}\/\d{4}.*$/] } cfg.join("\n") + "\n" end -- cgit v1.2.1