https://www.proz.com/forum/office_applications/69332-excluding_start_end_chars_in_word_find_replace.html

Excluding start/end chars in Word Find & Replace?
Thread poster: Jan Sundström
Jan Sundström
Jan Sundström  Identity Verified
Sweden
Local time: 09:40
English to Swedish
+ ...
Mar 27, 2007

Hi all,

I first posted this question in the Trados subforum (http://www.proz.com/post/538956#538956), but the crux of the matter is actually a Word problem.

I have a bunch of files that looks like:
=>'Uploaded', 'ulspeed'
=>'Downloaded', 'dlspeed'
etc

I want to tag everything except the source word within the single quotes as tw4winExternal
... See more
Hi all,

I first posted this question in the Trados subforum (http://www.proz.com/post/538956#538956), but the crux of the matter is actually a Word problem.

I have a bunch of files that looks like:
=>'Uploaded', 'ulspeed'
=>'Downloaded', 'dlspeed'
etc

I want to tag everything except the source word within the single quotes as tw4winExternal.

Is there any regex that can do this in one single operation?

The current suggestion is that I:
1. Mark the entire document as tw4winExternal
2. Make a wildcard search for
=>'*',
and replace this with (empty) + the tw4winNone template
3. Make separate litteral searches for =>' and ', to convert the start and end chars back to external again.

Or is there an advanced query I can perform in step 2, that would exclude the start/end chars from being changed to tw4winNone?

I learnt a lot from Aleksandr Okunev (author of TortoiseTagger):
http://www.proz.com/post/219086#219086

But this info takes a lot of time to digest and understand, I'm not quite there yet...

Thanks a lot in advance!

/Jan
Collapse


 
Jerzy Czopik
Jerzy Czopik  Identity Verified
Germany
Local time: 09:40
Member (2003)
Polish to German
+ ...
Do a S&R with following settings: Mar 27, 2007

Search for: '^13*', '
Replace with: ^& and Style "Tw4external"
Wildcard characters on

This will mark everything but the second word in your text als TW4External. Please note, that you will have to modify the very frist segment manually, as there is no paragraph mark before it (^13 is paragraph mark, but you cannot use ^p because of widlcard characters, so you need it's ANSI code, which is ^13).

HTH
Jerzy


 
Jan Sundström
Jan Sundström  Identity Verified
Sweden
Local time: 09:40
English to Swedish
+ ...
TOPIC STARTER
I'll try this... Mar 27, 2007

Interesting solution, Jerzy!
I think I get your point.

To understand what's going on, can you explain what the ampersand represents?! (^&)

Best,

Jan


 
Claudia Krysztofiak
Claudia Krysztofiak  Identity Verified
Germany
Local time: 09:40
English to German
+ ...
Are ' and ' different characters? Mar 27, 2007

Your posting suggests that there is a difference between the start and end character. If so, you'd just have to turn around your strategy:

1. Mark the entire document as tw4winNone
2. Make a wildcard search for
=>end character'*start character'
(instead of start character'*end character')
and replace this with (empty) + the tw4winExternal template


 
Jerzy Czopik
Jerzy Czopik  Identity Verified
Germany
Local time: 09:40
Member (2003)
Polish to German
+ ...
Ampersand Mar 27, 2007

Ampersand tells Word to insert everything what it have found. In this particular case it means to insert everything between ' in the paragraph before and ', ' in the next paragraph (this is what Word is looking for) with tw4external style.

Jerzy


 
Jan Sundström
Jan Sundström  Identity Verified
Sweden
Local time: 09:40
English to Swedish
+ ...
TOPIC STARTER
Will not touch first and last segment in each file Mar 27, 2007

Claudia Krysztofiak wrote:

Your posting suggests that there is a difference between the start and end character. If so, you'd just have to turn around your strategy:

1. Mark the entire document as tw4winNone
2. Make a wildcard search for
=>end character'*start character'
(instead of start character'*end character')
and replace this with (empty) + the tw4winExternal template




Hi Claudia,

I've been considering this solution too, but the disadvantage is slightly bigger than with Jerzy's alternative.

Since you search will handle (end character'*start character'), this query will not touch the very first start char + the very last end char in the file.

Not a huge issue, but there are over 200 files, and I want to minimize manual handling.

Best,

Jan


 
Vito Smolej
Vito Smolej
Germany
Local time: 09:40
Member (2004)
English to Slovenian
+ ...
SITE LOCALIZER
to find QxyzQ Mar 27, 2007

... excluding the starting and ending Q (for quote charachter) the Reg.expression in Word is somewthing like

Q([!Q]@)


explanation:

1. first Q - literal Q character - startup of the interesting sequence

2. ( ..... ) - grouping - so that you can adress it like \1 in replace field

3 [!Q]@ - a string containing anything but Q - i.e ending on Q

that should do it. In replace you say Q\1 and make it translatable, the
... See more
... excluding the starting and ending Q (for quote charachter) the Reg.expression in Word is somewthing like

Q([!Q]@)


explanation:

1. first Q - literal Q character - startup of the interesting sequence

2. ( ..... ) - grouping - so that you can adress it like \1 in replace field

3 [!Q]@ - a string containing anything but Q - i.e ending on Q

that should do it. In replace you say Q\1 and make it translatable, then change Q (sigh, I dont know any better) external.

smo

PS: learnt from Tortoise Alexij (g)

[Edited at 2007-03-27 15:05]
Collapse


 


To report site rules violations or get help, contact a site moderator:


You can also contact site staff by submitting a support request »

Excluding start/end chars in Word Find & Replace?






Trados Studio 2022 Freelance
The leading translation software used by over 270,000 translators.

Designed with your feedback in mind, Trados Studio 2022 delivers an unrivalled, powerful desktop and cloud solution, empowering you to work in the most efficient and cost-effective way.

More info »
CafeTran Espresso
You've never met a CAT tool this clever!

Translate faster & easier, using a sophisticated CAT tool built by a translator / developer. Accept jobs from clients who use Trados, MemoQ, Wordfast & major CAT tools. Download and start using CafeTran Espresso -- for free

Buy now! »