This project has moved and is read-only. For the latest updates, please go here.

Is the backreference supported by this tool?

Nov 14, 2012 at 7:41 AM

Following statement is supported:

There are many syntax differences between the regular expressions that can be used in Find what and Replace with and those that are valid in .NET Framework programming. For example, in the Find and Replace window, braces {} are used for tagging expressions to be replaced: to change every occurrence of doesn't to does not, you would use the find expression {does}n't and the replace expression \1 not.

May 7, 2013 at 3:52 PM
What is the syntax for a replace with backreference in this tool? I think I am able to group my "find" using round brackets (), but using a \1 in the replace replaces a literal "\1".

I generated the following command line from the GUI. What do I use instead of "\1" to get the backreference working? I've tried {} in both the find (doesn't find it) and replace (literal replace).

"fnr.exe" --cl --dir "C:\" --fileMask "testFile.txt" --includeSubDirectories --useRegEx --find "(file)" --replace "\1"

The contents of "testFile" are:
This is a test file. Testing foo bar.

Jun 26, 2013 at 11:38 AM
Hi Maandim and Tinah,

Here is how to back reference works in .NET RegEx object used by FnR.

Let's say you have a text file with text:

trellis llama webbing dresser swagger

And you want to find all double letters (like ll, bb, ss, gg) and replace them with single letter.
To do that you can use:

Find: (\w)\1
Replace: $1

Make sure you have "Use regular expressions" checked.