Miso5152
Miso5152

Reputation: 21

Search and replace with particular phrase

I need a help with mass search and replace using regex. I have a longer strings where I need to look for any number and particular string - e.g. 321BS and I need to replace just the text string that I was looking for. So I need to look for BS in "gf test test2 321BS test" (the pattern is always the same just the position differs) and change just BS. Can you please help me to find particular regex for this?

Update: I need t keep the number and change just the text string. I will be doing this notepad++. However I need a general funcion for this if possible. I am a rookie in regex. Moreover, is it possible to do it in Trados SDL Studio? Or how am i able to do it in excel file in bulk?

Thank you very much!

Upvotes: 0

Views: 48

Answers (2)

Paul
Paul

Reputation: 3

You could do this in Trados Studio using an app. The SDLXLIFF Toolkit may be the most appropriate for you. The advantage over Notepad++ is that it's controlled and will only affect the translatable text and not anything that might break the integrity of the file if you make a mistake. You can also handle multiple files, or even multiple Trados Studio projects in one go. The syntax would be very similar to the suggestion above... you would:

  • match (\d+)BS
  • replace $1NEWTEXT

Upvotes: 0

Scheir
Scheir

Reputation: 79

Your question is a bit vague, however, as I understand it you want to match any digits followed by BS, ie 123BS. You want to keep 123 but replace BS?

Regex: (\d+)BS matches 123BS

In notepad++ you can:

  • match (\d+)BS

  • replace \1NEWTEXT

This will replace 123BS with 123NEWTXT.

\1 will substitue the capture group (\d+). (which matches 1 or more digits.

Upvotes: 2

Related Questions