Search code examples
sublimetext3sublimetext2sublimetext

Sublime - in each line delete text before and after specific WORD


I have a million lines text that looks like:

HELLO random1 WORLD
HELLO random2 WORLD
HELLO random3 WORLD

How with the tools Sublime provide, I can extract only the text that I need so the result would be:

random1 
random2 
random3

Solution

  • Search using regex, with this parameter HELLO (\w+) WORLD and replace it with \1 (or $1)

    the \w is regex for a word. And the brackets around it capture it and assign it to the variable $1