Share via

The find what text contains a pattern match expression which is not valid

Anonymous
2022-11-18T14:00:54+00:00

I wanna change some topics for italic and underline.

From this:

(1) Constitution: the vast majority of contemporary constitutions describe the basic principles of the state, the structures and processes of government and the fundamental rights of citizens in a higher law that cannot be unilaterally changed by an ordinary legislative act. This higher law is usually referred to as a constitution.

To this:

(1) Constitution: the vast majority of contemporary constitutions describe the basic principles of the state, the structures and processes of government and the fundamental rights of citizens in a higher law that cannot be unilaterally changed by an ordinary legislative act. This higher law is usually referred to as a constitution.

To do so, I'm trying to use these wildcards:

Find what: (()(*)(:)
Replace with: \1\2\3 with font italic and underline

However, it appears the following error: "The find what text contains a pattern match expression which is not valid".

How can I solve this problem?

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
  1. HansV 462.6K Reputation points MVP Volunteer Moderator
    2022-11-19T11:47:31+00:00

    You could make the folder containing the document a Trusted Location for Word.

    File > Options > Trust Center > Trust Center Settings... > Trusted Locations > Add New Location...

    2 people found this answer helpful.
    0 comments No comments
Answer accepted by question author
  1. HansV 462.6K Reputation points MVP Volunteer Moderator
    2022-11-18T14:40:38+00:00

    Use

    \(*:
    

    in the Find what box, and

    ^&
    

    in the Replace with box. Don't forget to tick the check box Use wildcards.

    2 people found this answer helpful.
    0 comments No comments
Answer accepted by question author
  1. HansV 462.6K Reputation points MVP Volunteer Moderator
    2022-11-18T15:57:54+00:00

    I don't know how to do that. Theoretically, this should work:

    \(?{1,25}:
    

    but for some reason it has the same effect as (*: on my PC.

    1 person found this answer helpful.
    0 comments No comments

14 additional answers

Sort by: Most helpful
  1. HansV 462.6K Reputation points MVP Volunteer Moderator
    2022-11-18T21:47:16+00:00

    You could create the following macro in your default template Normal.dotm:

    Sub ItalicUnderline()
        With ActiveDocument.Content.Find
            .ClearFormatting
            .Text = "\([!^13]@:"
            .MatchWildcards = True
            .Replacement.ClearFormatting
            With .Replacement.Font
                .Italic = True
                .Underline = wdUnderlineSingle
            End With
            .Execute Replace:=wdReplaceAll
        End With
    End Sub
    

    You can then run it whenever you need it. You can even assign it to a Quick Access Toolbar button and/or a keyboard shortcut.

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2022-11-18T14:49:49+00:00

    Thank you so much!!!

    0 comments No comments