Regular Expression "Replace with" Field: Asterisk Issue

Hello everyone,

I want to find and replace segments that contain an asterisk. I have enabled regular expressions and entered \* ([1-4]) : in the Find what field and *$1 in the Replace with field. However, it displayed the error message "parsing "*" - Quantifier (x,y) following nothing." It seemed the asterisk cannot be used as-is, without an escape character.

So, I tried \*$1, but the Find process worked while the word was replaced with a yen mark and an asterisk (\*), not just an astersk.

I submitted a ticket to a Support, and the representative suggested using (\*) (\d) :  in the Find what field and $1$2 in the Replace with field. Of course it works, and I understad the logic -- but what I want to know is how to use an asterisk as an replacement character.

Could anyone help me understand why I cannot use an asterisk in the Replace with field, and what should I do instead?

Regards,



Removed AI Suggestion
[edited by: Ayaka Ito at 10:16 AM (GMT 0) on 5 Mar 2026]
emoji
Parents
  • Probability score: 0.7  

    Question improvement suggestion: Provide the exact version of Trados Studio you are using, as well as any specific error messages encountered during your attempts.  

    In the meantime, based on the information you have provided, here is a suggested answer to your question:  

    Hello,  

    It seems you are encountering issues with using an asterisk (*) in the "Replace with" field of your regular expression in Trados Studio. Here’s a step-by-step breakdown of the situation and some guidance on how to proceed:

    **Step 1:** Understand the Role of the Asterisk  

    The asterisk (*) is a special character in regular expressions that acts as a quantifier, meaning "zero or more" of the preceding element. When you want to use it literally (as a character), you need to escape it with a backslash (\\).

    **Step 2:** Correct Usage in the Find and Replace Fields  

    In your case, when you want to find segments containing an asterisk followed by a number, you should use the following in the "Find what" field:  

    `(\*) ([1-4])`  

    This captures the asterisk and the number in separate groups.

    For the "Replace with" field, you should use:  

    `$1$2`  

    This will replace the found pattern with the asterisk followed by the number, as intended.

    **Step 3:** Why the Asterisk is Not Working as Expected  

    The error message you received indicates that the regex engine is interpreting the asterisk as a quantifier rather than a literal character. This is why escaping it is necessary. If you simply use `*` without escaping, it will not work as you expect.

    **Step 4:** Alternative Workaround  

    If you want to replace the asterisk with another character or string, you can use a different approach. For example, if you want to replace it with a literal asterisk, you can use:  

    `\\*` in the "Find what" field and `*` in the "Replace with" field. However, this may not be necessary if you are already capturing it correctly.

    **Step 5:** Testing Your Regex  

    Always test your regex in a small sample to ensure it behaves as expected before applying it to larger documents. This will help you avoid unintended replacements.

    If you continue to experience issues, please provide the exact version of Trados Studio you are using, as well as any specific error messages encountered during your attempts. This information will help in diagnosing the problem more effectively.

    I hope this answer addressed your question. If not, please reject the answer, add the question improvement suggestion information, and click the RWS Community AI checkbox on the right to try again.  

    RWS Community AI

    emoji
Reply
  • Probability score: 0.7  

    Question improvement suggestion: Provide the exact version of Trados Studio you are using, as well as any specific error messages encountered during your attempts.  

    In the meantime, based on the information you have provided, here is a suggested answer to your question:  

    Hello,  

    It seems you are encountering issues with using an asterisk (*) in the "Replace with" field of your regular expression in Trados Studio. Here’s a step-by-step breakdown of the situation and some guidance on how to proceed:

    **Step 1:** Understand the Role of the Asterisk  

    The asterisk (*) is a special character in regular expressions that acts as a quantifier, meaning "zero or more" of the preceding element. When you want to use it literally (as a character), you need to escape it with a backslash (\\).

    **Step 2:** Correct Usage in the Find and Replace Fields  

    In your case, when you want to find segments containing an asterisk followed by a number, you should use the following in the "Find what" field:  

    `(\*) ([1-4])`  

    This captures the asterisk and the number in separate groups.

    For the "Replace with" field, you should use:  

    `$1$2`  

    This will replace the found pattern with the asterisk followed by the number, as intended.

    **Step 3:** Why the Asterisk is Not Working as Expected  

    The error message you received indicates that the regex engine is interpreting the asterisk as a quantifier rather than a literal character. This is why escaping it is necessary. If you simply use `*` without escaping, it will not work as you expect.

    **Step 4:** Alternative Workaround  

    If you want to replace the asterisk with another character or string, you can use a different approach. For example, if you want to replace it with a literal asterisk, you can use:  

    `\\*` in the "Find what" field and `*` in the "Replace with" field. However, this may not be necessary if you are already capturing it correctly.

    **Step 5:** Testing Your Regex  

    Always test your regex in a small sample to ensure it behaves as expected before applying it to larger documents. This will help you avoid unintended replacements.

    If you continue to experience issues, please provide the exact version of Trados Studio you are using, as well as any specific error messages encountered during your attempts. This information will help in diagnosing the problem more effectively.

    I hope this answer addressed your question. If not, please reject the answer, add the question improvement suggestion information, and click the RWS Community AI checkbox on the right to try again.  

    RWS Community AI

    emoji
Children
No Data