Skip to content

Instantly share code, notes, and snippets.

@atton
atton / gist:2300884
Created April 4, 2012 12:56
regexp "foobar" v2
# -*- coding: utf-8 -*-
# fooが頭に無いbarをファイルに出力する 1.2
array = ["foo","bar","baz","hoge"]
reg = /(?<!foo)bar/
file_name = "./hoge.txt"
f = File.open file_name,"a+"
@atton
atton / gist:2300727
Created April 4, 2012 12:14
double regexp "foobar"
# -*- coding: utf-8 -*-
# fooが頭に無いbarをファイルに出力する 2
array = ["foo","bar","baz"]
file_name = "./hoge.txt"
f = File.open file_name,"a+"
array.each do |head|
@atton
atton / gist:2300703
Created April 4, 2012 12:08
regexp "foobar"
# -*- coding: utf-8 -*-
# fooが頭に無いbarをファイルに出力する
reg = /(?<!foo)bar/
array = ["foo","bar","baz"]
file_name = "./hoge.txt"
f = File.open file_name,"a+"