It’s been a long time! As I don’t follow the instructions blindly but prefer finding my own way, I’ll introduce you to one of the simple but effective features in Atom editor called “Use Regex”.

Screen Shot 2017-08-02 at 12.57.42
Use Regex

I know it’s cool. If you are in the ancient VIM, Emacs division or at least had an experience of using it you might be aware of this feature that literally saves your ass from tons of boring copy-paste operations. But if it’s the first time you hear about it?

Once I had to extract all the found IDs in the text and to be able to look up for the entries in the database. In case if you can find the entries and it’s related for example to the same user or has some relation based on the particular ID. It’s gold. But what if not?

Imagine in the buffer you have the following constraintScreen Shot 2017-08-02 at 14.10.12

Of course, if it’s just a few entries matching the “id” => “N” it’s simple. But what if it’s a thousand of entries? What you gonna do about it? And then you want to get a list in one line like 1, 2, 3, 4, … 17 then what?

The answer is Regex! It is always somewhere near. Like a magic stick. It’s actually obvious that in any situation like this it can help you to get out dry from the water.

In other words, just by pressing “Use Regex” option you can write the regular expression, select all the lines by pressing Alt+Enter. Copy and Paste then do it again and replace with “$1, “. Bam! Done.

If you found the article helpful, you are welcome to press like or share it with your friends.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s