29
himalay
8y

Learning regex is like finding a scalpel when thus far you've been trying to dissect a frog with a chainsaw.

Comments
  • 1
    @g-m-f As a developer how can you not use regex for couple weeks? You should be using regex every day, at least for find and replace stuff. Try your regex here http://regexr.com/
  • 0
    @g-m-f I meant, use of regex while doing find and replace in IDE/Text-editor, or while using find/grep/sed/awk in cli.
  • 1
    @g-m-f Let me show you an example. Let's say you have this paragraph texts with a bunch of URLs and you want to add anchor tags to all of them.

    eg.
    This is a http link to http://google.com and this is https link to https://google.com.np. Here is another http link to http://www.devrant.io and https link to https://www.devrant.io.

    You can use the following regex to add anchor tags to all the different URLs at once.

    Find:(https?:\/\/([\w\.]+\w+))
    Replace:<a href="$1">$2</a>
  • 0
    All I knew about regex even before actually using it was.. if you have a problem that you want to solve with regex you will only end up with two problems.
    turned out to be pretty true.
Add Comment