anonymous / filter.rb
Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

answer to a question on ruby-talk

View filter.rb
1 2 3 4 5 6 7 8 9 10 11 12
#regexes for find/replace
add_tabs = /^(term1)/
remove_tab = /\t(\tterm2)/
clear_stuff = /.*hat\.goat\sthis thing\sthat thing\sstuff\scheese/m
 
 
#read file and replace
puts "Paste in your input:"
while (line = gets)
next if $. == 1 .. line =~ clear_stuff
print line.gsub(add_tabs, "\t\t\\1").gsub(remove_tab, "\\1")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.