Find & Replace: Regex - "replace only first match and ignore others"

Hi SDL community,

I'd like to find and capture only the first "text" in each segment and replace it with e.g. "paraghraph

Segment 1: In years of attending school, most of us have dealt with a number of different technical texts, or texts intended to educate the reader in a particular subject or skill through in-depth study and practice texts.(do not capture or even when matched, do no replace this one)

Segment 2: Technical texts, such as a chemistry textbook or car repair manual texts, which represents any verse or prose work meant to be instructional text.

What would be the regex for:

Find: ......

Replace: .....

Parents
  • Paul and Anthony, I have a similar, yet different issue here, if I may.

    I'd like to match the space (\s) + whatever the text until the first occurence of "içinde", and then move this string just after the "olarak,"

    I tried to visualise it as below:

    Screenshot of Trados Studio showing a text segment with a red underline indicating an error at the word 'icinde'. There are handwritten annotations suggesting text movement.

    This is the actual text:

    Bileşik 001a şema 11'in adım 65'inde bildirilen usule uygun olarak, metil 5-(2-((7-(2-(((tert-butoksi)amino)trimetil)piridin-4-il)-2-izobutilbenzofuran-5-il)metoksi)fenil)asetat'tan (21b) (200 mg, 0,349 mmol) DCM (20 mL) içinde, TFA (5,269 mL, 8,49 mmol) kullanılarak hazırlanmıştır.

    (Content changed not to violate any right if any.)

    I'd very much appreciate if you could offer a solution.

     

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 4:36 AM (GMT 0) on 5 Mar 2024]
  • Hi all again,

    As you might have discerned from this example, post editing (syntax change operations) target text segments by Trados Find & Replace or possibly by AHK scripts, while keeping tags in place is an unmet requirement currently in the industry.

    Please somebody prove otherwise, I need such kind of requirements so often in my projects,

    Regards everyone

  • If you are really determined, and brave enough, you could do the regex operation directly on the sdlxliff files.  Then the tags will be incorporated as they are essentially just characters and not protected as they are in Studio.  I have not tested this, nor am I going to, but if you have a play with your newfound knowledge I'm sure you will be able to do this.  A decent text editor could also support doing this across multiple files.

    You should also make your request for this to be something available in the product in the ideas site rather than just here in a thread on regex:

    https://ideas.sdl.com

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

Reply
  • If you are really determined, and brave enough, you could do the regex operation directly on the sdlxliff files.  Then the tags will be incorporated as they are essentially just characters and not protected as they are in Studio.  I have not tested this, nor am I going to, but if you have a play with your newfound knowledge I'm sure you will be able to do this.  A decent text editor could also support doing this across multiple files.

    You should also make your request for this to be something available in the product in the ideas site rather than just here in a thread on regex:

    https://ideas.sdl.com

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

Children