Created
April 4, 2012 12:14
-
-
Save atton/2300727 to your computer and use it in GitHub Desktop.
double regexp "foobar"
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
# fooが頭に無いbarをファイルに出力する 2 | |
array = ["foo","bar","baz"] | |
file_name = "./hoge.txt" | |
f = File.open file_name,"a+" | |
array.each do |head| | |
array.each do |foot| | |
str = head + foot | |
if !(str =~ /foobar/) && (str =~ /bar/) | |
f.puts str | |
end | |
end | |
end | |
f.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment