Copy marked text

  • Is there way to copy only the text which is marked (matched with regex)? I can remove unmarked lines but I would like to remove the text around the marked text as well. I was thinking I could do a find and replace but I’m not sure how to do a reverse regex, as in selecting everything the regex doesn’t match. My regex skill is rather weak.

    random text and characters : 12 more random test
    more random text : 45 more random characters

    I can match the numbers 12 and 45 with (?: [0-9]+) but now I need to delete everything around the number or copy and paste the number to a different file.

Log in to reply