Sublime Forum

Custom command to remove/edit multiple lines of text

#1

Hello!

Sometimes I have to copy/paste multiple lines of information from a database into a form. Instead of doing it one piece at a time, I want to copy everything, mark the text, press some keys and clean the text of irrelevant information leaving only the lines I need, and then wrap the lines in some code or tags. The data always have the same number of lines, and the relevant information is always on the same lines.

Here is an example of what a string of text might look like:

Number required
0123456
Name

Name Required
John Doe
Address

Required
Type the mobile phone number for the contact.

Main phone number
58432541410
2. Phone number

I would like to pull out:

0123456
John Doe
58432541410

And then mark the text again and with another command, wrap the text in something, for example:

{0123456}
{John Doe}
{58432541410}

I have been looking at the keybindings in Sublime text 3, and it seems like all the building blocks are there, but I don’t understand the code well enough to put them together.

0 Likes