Suppose you have large file with strings. I have a pattern which matches a subset of those strings, say a substring. How can I display those strings with everything else removed after the matched pattern (e.g. substring)? Is this possible with regular expressions?
Example: "this is one nasty string nobody likes"
My pattern: "nasty string"
Expected result: "this is one nasty string"