Last active
March 5, 2018 05:28
-
-
Save googya/eb6594f2a9f1e0981f1a54e5aeda5556 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
reg_obj = Regexp.new('([a-z]*\.?){1,3}\.ishanggang\.com') | |
s = `ag "#{reg_obj.to_s}"` | |
lines = s.split(/\t|\n/) | |
res = lines.each_with_object([]) do |e, arr| | |
if e =~ reg_obj | |
arr << $~.to_s | |
end | |
end.uniq.sort |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment