Created
December 4, 2014 01:32
-
-
Save anonymous/fcffdca5613636023e1b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def matchArray(line) | |
match = line.scan(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/) #[192.168.220.48] | |
match.each do |x| | |
split_array = x.split(".") #192 168 220 48 | |
return string_array = split_array.to_s.rjust(3, '0') #["192", "168", "220", "48"] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment