none
Word Find - MatchWildcards and MatchCase Incompatibility RRS feed

  • Question

  • When using Find with MatchWildcards = true, the search is case sensitive even if I set MatchCase = false.

    Is this the expected behavior?

    I'm working with Microsoft Office Professional Plus 2010 Version 14.0.7116.5000 , and Visual Studio 2012.

    Thanks

    Tuesday, August 26, 2014 7:19 AM

Answers

  • You can't use MatchCase = False with MatchWildcards = True; indeed, using MatchWildcards means you're effectively using MatchCase = True. If you don't want the wildcard expression to be case-sensitive, you need to encode it with both the lower-case and upper-case forms. For example:

    .Find.Text = "[Aa][Bc][Cc]"

    will find any of ABC, ABc, Abc, AbC, Abc, abc, aBC, abC, aBc.


    Cheers
    Paul Edstein
    [MS MVP - Word]

    Wednesday, August 27, 2014 6:23 AM
  • Hi,

    >>Is this the expected behavior?<<

    Yes, this behavior is by-design.

    In Word application, wildcard searches are case sensitive. When setting Find options manually, you can see that if you checked the Use wildcards, many other options will be disabled automatically, which contains Match case. So setting MatchCase = false cannot help.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, August 27, 2014 5:55 AM
    Moderator

All replies

  • Hi,

    >>Is this the expected behavior?<<

    Yes, this behavior is by-design.

    In Word application, wildcard searches are case sensitive. When setting Find options manually, you can see that if you checked the Use wildcards, many other options will be disabled automatically, which contains Match case. So setting MatchCase = false cannot help.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, August 27, 2014 5:55 AM
    Moderator
  • You can't use MatchCase = False with MatchWildcards = True; indeed, using MatchWildcards means you're effectively using MatchCase = True. If you don't want the wildcard expression to be case-sensitive, you need to encode it with both the lower-case and upper-case forms. For example:

    .Find.Text = "[Aa][Bc][Cc]"

    will find any of ABC, ABc, Abc, AbC, Abc, abc, aBC, abC, aBc.


    Cheers
    Paul Edstein
    [MS MVP - Word]

    Wednesday, August 27, 2014 6:23 AM