Problem with useRegEx

Oct 25, 2013 at 3:40 PM
Hello, and thank you for this great program.

I'm having a problem with fnr 1.4 with useRegEx to replace formatted text. When using something like
--find "<Unindented Text>\n\t<Indented Text>\n" --useRegEx
the program correctly identifies the formatted text.

However, when using
--find "<Unindented Text>\n\t<Indented Text>\n" --replace "<New Unindented Text>\n\t<New Indented Text>\n" --useRegEx
the program correctly converts \n to a new line but \t is written as a literal "\t".

Thanks for you help,
Coordinator
Oct 26, 2013 at 4:43 AM
Edited Oct 26, 2013 at 4:50 AM
Hi Marco,

fnr.exe currently works in the following way, when generating command line:

-- If you use RegEx, FindText is taken as is, since it shouldn't have any line breaks or characters like tabs, which should already be using \n (or \r\n) and \t.

-- If RegEx is not used, FindText is modified as follows, to work in command line
  • line break (\r\n) is converted to '\n'
  • quotes are converted to \" because quote can also be used as argument delimiter for example fnr.exe --find "some \"string\" in quotes"
-- ReplaceText works always the same if RegEx is enable or disabled.
  • '\n' is converted back to \r\n
  • \" is converted back to "
So in your case, try using actual tab instead of \t in replace text. It should look like this:
"<New Unindented Text>\n<actual tab goes here>\n"

Eric
Marked as answer by MarcoL on 10/26/2013 at 7:27 AM
Oct 26, 2013 at 2:26 PM
Thanks Eric, that did the trick.

Marco