Regex to find "%2$s"

Hi Community,

Do you know how the elements in bold in the text could be found with regex?

No.SíSU PIN code: %1$s For a pre-authorization, for a period of one which is the cost of the banco, and for the maximum duration of the Community's current State, the community shall be open to a pre-authorization.%2$s
%s  La date de sortie sélectionnée est antérieure à la date d\'entrée dans le parking (%1$s).


I came up with this:
%(\d.)*(s)*

And according to the RegExr website it checks out:
Screenshot of RegExr website with a regex expression highlighted in red box, showing a test string and a match list.

But when I add this to Studio (Plain Text embedded content processor), it does not work there:
Screenshot of Trados Studio error message indicating regex does not work in Plain Text embedded content processor.

Can you please help? What am I missing or doing wrong?

Thank you!
Greta



Generated Image Alt-Text
[edited by: Trados AI at 4:34 AM (GMT 0) on 5 Mar 2024]
emoji
Parents
  • Your file is a xml one and is parsed with the xml parser. Why do you add this regex in the plain text file type? Have you activated the embedded content processing in XML via plain text? If so, did you add the proper structure rules to it?

    And for your regex, use %\d+?\$s - you do not need any brackets there, as you do not need capturing groups or other grouping.

    _________________________________________________________

    When asking for help here, please be as accurate as possible. Please always remember to give the exact version of product used and all possible error messages received. The better you describe your problem, the better help you will get.

    Want to learn more about Trados Studio? Visit the Community Hub. Have a good idea to make Trados Studio better? Publish it here.

  • Hi

    Thank you for your reply.

    Indeed it's an XML file and I created a custom file type for it, and activated the embedded content processing, chose the Plain Text processor, as I thought it would give me the flexibility to convert this into a tag. Was this the right way to go about it?

    Also I tried the regex you suggested but it only finds this: %1$s  and misses the others highlighted above.

    Can you please advise? I can send you my file type settings and a sample file maybe, if you think?

    Thank you.

  • You can gladly send me the file. In my regex I overseen, that you wanted to catch %s too. So use this %\d*\$*?s

    And in your xml file type make sure, that the embedded content processing is activated for the necessary elements.

    My mail is info at tts-td dot com

    _________________________________________________________

    When asking for help here, please be as accurate as possible. Please always remember to give the exact version of product used and all possible error messages received. The better you describe your problem, the better help you will get.

    Want to learn more about Trados Studio? Visit the Community Hub. Have a good idea to make Trados Studio better? Publish it here.

Reply
  • You can gladly send me the file. In my regex I overseen, that you wanted to catch %s too. So use this %\d*\$*?s

    And in your xml file type make sure, that the embedded content processing is activated for the necessary elements.

    My mail is info at tts-td dot com

    _________________________________________________________

    When asking for help here, please be as accurate as possible. Please always remember to give the exact version of product used and all possible error messages received. The better you describe your problem, the better help you will get.

    Want to learn more about Trados Studio? Visit the Community Hub. Have a good idea to make Trados Studio better? Publish it here.

Children