Hello Robert and Janet,
Seemingly, as you seem comfortable with regular expressions, you could easily extract the matched strings with a simple regex ?
For instance, let’s suppose the simple list of people of an enterprise, below :
Occupation   Age   Title     Name    Forename
---------------------------------------------
Technician    50    Mr      SMITH     John
Secretary     25    Miss    BROWN     Amy
Manager       40    Mrs     HARPER    Edith
.......       ..    ...     ......    .....
and that you would like to do some statistics, depending on the age and/or the title of these persons. Then, you would need, ( may be for confidentiality ! ) to extract, ONLY, the second and third columns of that list. If so :
Copy this list in an new tab of N++
Perform the S/R, below, in Regular expression search mode :
SEARCH .*?(\d+ +\w+).*
REPLACE \1
If, in addition, you would prefer to delete any line, that does NOT match the regex, use, instead the S/R below :
SEARCH .*?(\d+ +\w+).*|^.*\R
REPLACE \1
You’ll only get the strings matched by the regex, below :
50    Mr
25    Miss
40    Mrs
Note :
If the regex can’t be found, the first part of the alternative is not matched ( so, the group \1 doesn’t exist ) but the second part of the alternative is, obviously, always matched, as it matches an entire line, with its EOL character(s)
Best Regards,
guy038