How do I ... ?

How to use FAR?

The FIND command will always be the first command to be executed, since you have to define the set of files to operate on before you may apply any changes.

Select a base directory and a file name pattern such as *.txt to specify where and what to seach.

Once the FIND command has run, you can operate on the set of found files. To exclude a file from a replace, rename or other operation, just uncheck the checkbox in the left column of the result list.

How to replace text in binary files?

Word documents and PDF files are binary files, not text files, even though they contain text. FAR on the other hand is a tool for text files, not binary files. As per default FAR does protect .docx, .pdf and other binary files from being altered. If you need to change such files, use an appropriate editor such as Microsoft Word or Adobe Writer.

However, there is an option in the FAR settings that, if disabled, allows to modify binary files: "Exclude binary files from replace operation". Use at your own risk.

How to find text spanning multiple line?

To add a line break into your search pattern, simply typ a second line like so:

Text that continues
on a second line.

No obscure construct such as "$\r?(?s:.)^" is required.

But there are situations when you do not know how many lines to find. Say you want to find all the Foo nodes in an XML document, that is all the text from <Foo> to </Foo>. If such a node can span any number of lines, you will need to apply the following expression:

<Foo>(?s:.+?)</Foo>

This combines the "dotall" flag ?s: with the quite exotic "reluctant" quantifier +?. The dotall flag makes the dot (.) represent line breaks also (wich it normaly does not). The "reluctant" quantifier +? prevents the regular expression parser from expanding the found text to the last closing </Foo> tag in the document.

How change file encoding?

First make sure the respective file has the right encoding assigned. The assigned encoding is disaplayed in the info view. Click with the right mouse button to get it. If the assigned encoding is not the files real (current) encoding, change the assigned encoding first. You can do this in the info view as well.

Next make sure only those files are checked (checkbox in left column of file list), that should have their encoding changed. Uncheck all other files, if any.

Eventually open the Tools menu and select the new encoding from the Change Encoding menu item.