Share via

Repeated Character

Anonymous
2014-11-08T04:42:38+00:00

Hello, i have some problems with repeated characters, for example some word said

wwoorrdd or WWWWoordd or ----wwwooorrd

 i didn't know how much characters are repeated or wich one they are, i tried with wildcards but i don't know how said that is the same chracter i tried with

(?){2,}

repleace:\1

but it look for any character so it see

tp 

like a posibility, anyone can help me please thz

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Doug Robbins - MVP - Office Apps and Services 323.1K Reputation points MVP Volunteer Moderator
2014-11-08T07:16:13+00:00

You could use a macro containing the following code:

Dim i As Long

Dim strFind As String

For i = 65 To 122

    If i < 91 Or i > 96 Then

        strFind = "[" & Chr(i) & "]{2,}"

        Selection.HomeKey wdStory

        Selection.Find.ClearFormatting

        With Selection.Find

            Do While .Execute(FindText:=strFind, Forward:=True, _

                MatchWildcards:=True, Wrap:=wdFindStop) = True

                Selection.Range.Text = Chr(i)

            Loop

        End With

    End If

Next I

but, it would change any replace the repeated characters in words like better, foot, feet, feed with just a single instance of the repeated character so that in the case of these examples, you would end up with beter, fot, fet, fed.

Was this answer helpful?

0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2014-11-13T17:26:22+00:00

    hello, thz sorry for answer late, i use the method that you show me last week. 

    Sorry about Cross-posted, i knew that i problably haven't my pc or office for about 1 or 2 weeks and i needed resolve it before it happend, thz and sorry again.

    Cross-posted (and answered) at: http://www.msofficeforums.com/word/23433-repeated-character.html#post73101

    For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2014-11-13T17:22:39+00:00

    thz for your answer, sorry for answer you too late, i didn't have acces to my pc until know, thz

    You could use a macro containing the following code:

    Dim i As Long

    Dim strFind As String

    For i = 65 To 122

        If i < 91 Or i > 96 Then

            strFind = "[" & Chr(i) & "]{2,}"

            Selection.HomeKey wdStory

            Selection.Find.ClearFormatting

            With Selection.Find

                Do While .Execute(FindText:=strFind, Forward:=True, _

                    MatchWildcards:=True, Wrap:=wdFindStop) = True

                    Selection.Range.Text = Chr(i)

                Loop

            End With

        End If

    Next I

    but, it would change any replace the repeated characters in words like better, foot, feet, feed with just a single instance of the repeated character so that in the case of these examples, you would end up with beter, fot, fet, fed.

    Was this answer helpful?

    0 comments No comments