find . -name '*.html' -exec sed -i "" 's/
//g' {} \;
Showing posts with label regex. Show all posts
Showing posts with label regex. Show all posts
Wednesday, November 30, 2016
bulk zap funk from grs content html on the command line
find . -name '*.html' -exec sed -i "" 's/
//g' {} \;
Friday, August 14, 2015
ruby gsub doesnt escape single quotes
# ' means $' which is everything after the match. Escape the \ again and it works
# http://stackoverflow.com/questions/2180322/ruby-gsub-doesnt-escape-single-quotes
to_fix = "Sporty's"
result = to_fix.gsub(/'/, "\\\\'")
puts "result=#{result}"
Friday, July 31, 2015
ruby regex group match and assign variables on 1 line using captures
http://stackoverflow.com/questions/9303984/ruby-regexp-group-matching-assign-variables-on-1-line
#!/usr/bin/env ruby string = "RyanOnRails: This is a test" one, two, three = string.match(/(^.*)(:)(.*)/i).captures p one #=> "RyanOnRails" p two #=> ":" p three #=> " This is a test"
Subscribe to:
Comments (Atom)