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!
Classic DEV Post from May 12

What Developers Should Know from Microsoft Build

We're clearly entering a new era for Microsoft and for developers that moves from tools and platforms to cloud and services.

READ POST
Follow @remotesynth to see more of their posts in your feed.
dev.to is now open source!
View Announcement Post View GitHub Repo
wataken44
Member since Nov 15, 2017
Trending on dev.to
#discuss What language do you think in?
#discuss #languages #programming
Understanding Object Oriented JavaScript
#javascript #beginners #webdev #discuss
How Do You Really Get Hired?
#careers #beginners #discuss
When is your code 'good enough'?
#discuss #beginners #productivity #webdev
What are common myths about software careers?
#discuss #career
What is your task management process? Do you use trello, asana, calendar etc or a hybrid? And how?
#productivity #tools
Using Custom Types in JavaScript Docs
#discuss #vscode #javascript #documentation
VerbalExpressions - RegularExpression made easy
#regex #regularexpressions