getting regex in a quick way

create snippets

#!/usr/bin/env ruby
# -*- coding: utf-8 -*-

# escape.rb

def main()
    ARGV.each do |arg|
        puts(Regexp.escape(arg))
    end
end

if __FILE__ == $0 then
    main()
end

run

$ ./escape.rb "http://www.google.com/"
http://www\.google\.com/

:D

Did you find this post useful? Show some love!
DISCUSSION
Classic DEV Post from Apr 25

What's your tech stack?

Photo courtesy of Flickr user kreturn I came across this post from @ben today...

READ POST
Follow @nickytonline to see more of their posts in your feed.
wataken44
Member since Nov 15, 2017
Trending on dev.to
Breaking up with my mouse (Mac edition)
#productivity #webdev
Don't code your microservice like a monolith, keep it maintainable not over-engineered
#tips #webdev #devops #productivity
Thoughts on GitHub Actions?
#github #discuss
Choose Your Next Article Topic With This Exercise
#writing #productivity
Goodbye
#goodbye #career
How To Stay Motivated When Learning to Code?
#discuss #help #programming
Designing A Voting System For 1 Billion on the Blockchain (Part 2) - How To Keep A Secret
#blockchain #opensource #architecture #discuss
How Can I Help Foster A Culture of Continual Learning?
#discuss #learning