Add regex support for replacements done using the "file of replacement strings"

Issue #589 new
David López created an issue

Dear all,

This time, I am using this feature, Ignore case differences, Search and Replace with filter, that should let you include terms in a Studio file even though they do not match regarding the case (uppercase and lowercase).

If I want to translate the term phone into Spanish, I would say teléfono. However, let's imagine such term appears in capital letters in the glossary I want to import (Phone). Besides, I have a huge glossary, and I don't want to replace all the terms with lowercase, since some of them might be fund names, proper names, .etc., and it is always much better to deal with them if they are already in uppercase.

I found there is an option to Ignore case differences. I checked it, but it does not make any difference, since the term is not included. If this would work, I would be able to add more terms into the Studio file.

Can you look into this for me and let me know the way this could work? Your help is always much appreciated!

Note I created an example, so that you can also check what I mean (see it attached).

Regards,

David

Comments (3)

  1. YvesS

    This is not a bug, but a limitation of the current implementation. See the documentation for the "Search and Replace Step: http://okapiframework.org/wiki/index.php?title=Search_and_Replace_Step

    Path of file with replacements — ... This file is not loaded into the table below but processed separately AFTER the table expressions have been processed. The replacements in the tab delimited file is currently limited to literal searches (non-regex and true with sub-strings). ...

    As you can see, the replacement of the entries in the file are just literal search and replace, no regular-expression or option is used.


    I'm changing this issue from 'bug' to 'enhancement'.

    And the enhancement is to implement regular expression support for the replacement done using the file of replacement strings.

    • This should probably be done as an new option to preserve backward compatibility.
    • Ignoring case difference would be done through the regex inline option (?i)
  2. David López reporter

    Dear Yves,

    Thanks again for your quick reply!

    To sum things up: is it not possible then to use both RegEx and the file of replacement strings to process a file with Rainbow?

    What would be your suggestion for a workflow for a file in which I cannot take advantage of the terms that are in a glossary because of this issue with the uppercase and lowercase?

    Regards,

    David

  3. YvesS

    Alas, until the regex is implemented for the strings of the file, the only solution to do S&R with case sensitivity off is to list the terms in the table. For those entries you can use the options listed in the UI, like "Ignore case differences". Note that you can import and export the options, so maybe you can create a file to import based on your list of terms. To know the format of the file, add a couple of term in the table and do an export, you'll see how it looks like. Then you could copy your list of terms and "massage" them to follow the syntax;

    ...
    count.i=2
    use0=true
    search0=term1
    replace0=trans1
    use1=true
    search1=term2
    replace1=trans2
    etc..
    
  4. Log in to comment