This site uses cookies.
Some of these cookies are essential to the operation of the site,
while others help to improve your experience by providing insights into how the site is being used.
For more information, please see the ProZ.com privacy policy.
Samuel Murray Netherlands Local time: 04:54 Member (2006) English to Afrikaans + ...
May 22, 2018
Hello everyone
Using MS Word, is there a search string or a macro that will find and/or highlight all repeated words? I know that repeated words are flagged during spell-check but I want to look for ONLY repeated words. By "repeated words" I mean words that repeat next to each other, e.g. "the" in "paris in the the spring".
Alternatively, what would the search strings be in regular expressions in a regex capable text editor?
Thanks
Samuel
Subject:
Comment:
The contents of this post will automatically be included in the ticket generated. Please add any additional comments or explanation (optional)
Thomas T. Frost Portugal Local time: 03:54 Danish to English + ...
I would use Excel
May 22, 2018
I would split the whole Word file into one word per line (using the Replace function: " " to "^p" to change blanks to line breaks), then copy and paste the whole thing into Excel, where you can use a formula such as "if(A1=A2;"REPEATED";"") and copy it down.
You may need to remove some blank lines first. You could start by numbering all the Excel lines (use copy series down). Then you can sort on the text column, remove the blank lines, then sort again on the line numbers to get the... See more
I would split the whole Word file into one word per line (using the Replace function: " " to "^p" to change blanks to line breaks), then copy and paste the whole thing into Excel, where you can use a formula such as "if(A1=A2;"REPEATED";"") and copy it down.
You may need to remove some blank lines first. You could start by numbering all the Excel lines (use copy series down). Then you can sort on the text column, remove the blank lines, then sort again on the line numbers to get the text back in the original order.
The contents of this post will automatically be included in the ticket generated. Please add any additional comments or explanation (optional)
Philip Lees Greece Local time: 05:54 Greek to English
Regex for repeats
May 23, 2018
Samuel Murray wrote:
Alternatively, what would the search strings be in regular expressions in a regex capable text editor?
This works in perl:
$_ = 'Paris in the the spring is a wonderful wonderful time';
print "$1\n" while /([a-zA-Z]{2,})\s+\1/g;
The output is:
the
wonderful
This only catches repeats of groups of at least two alphabetical characters, separated by at least one space.
You may be able to tweak it if it's not quite right.
The $1 represents the matched string and in contexts other than perl may need to be replaced by \1, which also represents the repeated part in the regex.
The g flag at the end forces it to search the entire string for matches, rather than returning the first match over and over again.
Subject:
Comment:
The contents of this post will automatically be included in the ticket generated. Please add any additional comments or explanation (optional)
Philip Lees Greece Local time: 05:54 Greek to English
And in Word
May 23, 2018
Samuel Murray wrote:
Using MS Word, is there a search string or a macro that will find and/or highlight all repeated words?
Well whaddyaknow? My regex also works in Word with a few tweaks.
Search for:
([a-zA-Z]{2,}) @\1
with "Use wildcards" checked.
I didn't know Word's search function could handle repeat matches like that.
Subject:
Comment:
The contents of this post will automatically be included in the ticket generated. Please add any additional comments or explanation (optional)
Samuel Murray Netherlands Local time: 04:54 Member (2006) English to Afrikaans + ...
TOPIC STARTER
Yes, pleasant surprise
May 23, 2018
Philip Lees wrote:
Well whaddyaknow? My regex also works in Word with a few tweaks.
I didn't know Word's search function could handle repeat matches like that.
(-:
Subject:
Comment:
The contents of this post will automatically be included in the ticket generated. Please add any additional comments or explanation (optional)
Philip Lees Greece Local time: 05:54 Greek to English
Translation Office 3000 is an advanced accounting tool for freelance translators and small agencies. TO3000 easily and seamlessly integrates with the business life of professional freelance translators.
Exclusive discount for ProZ.com users!
Save over 13% when purchasing Wordfast Pro through ProZ.com. Wordfast is the world's #1 provider of platform-independent Translation Memory software. Consistently ranked the most user-friendly and highest value