How to exclude some words that contain the string I'm looking for?

0 votes

I need to search for the string "ftp"

But I need to exclude "myftppath" and "itsaftpstring"

And I don't want to exclude other words that may contain ftp like "theftpsite"

Any clue/help is the most welcomed.

asked Feb 23 by Charles (30 points)
I realize I should have been more specific: the question is related to RANSACK and it's about regular expression regarding the text I'm looking for in files.
Try this regular expression: (?<!my|itsa)ftp(?!path|string)
It tells the engine to find all instances of 'ftp' which are not preceded by either 'my' or 'itsa', and which are not followed by either 'path' or 'string'

1 Answer

0 votes

It's not possible to specify 'ftp' but not 'myftppath' with Boolean expressions. However, it is possible with FileLocator Pro to specify that a search is matched on a line-by-line basis so that any NOT only affects each line separately and not the whole file:

Options tab

For example:

Containing Text: ftp NOT (myftppath OR itsaftpstring)

Would find the text on line 1 and 3:

line 1: This FTP Sample
line 2: Include myftppath and
line 3: a site called theftpsite


answered Feb 23 by dave (55,690 points)