Consulting

Results 1 to 5 of 5

Thread: Wildcard Search Including Special Characters

  1. #1

    Wildcard Search Including Special Characters

    Hello,

    Would it be possible to have a wildcard search to handle the following?

    70402 Landpiper Dr Apt 27, DauLtan, Tx 77092-4542, DarriL (Jan2074-Feb2078)
    70402 Landpiper Dr Apt 720, DauLtan, Tx 77092-4550, DarriL (Aug2072-DeP2072)

    The bold section between, including the hyphen and the closing parentheses should be deleted. Any assistance would be appreciated.

    Thank you.

  2. #2
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,340
    Location
    You don't need VBA for that. Just search for: -*\) and replace with nothing.
    Greg

    Visit my website: http://gregmaxey.com

  3. #3
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    I'd probably go for a wildcard Find/Replace with:
    Find = -[0-9]{4}*\)
    Replace = nothing
    just so as to avoid false matches with hyphens earlier in the string (e.g. 70402 Landpiper-Smith Dr Apt 27, DauLtan, Tx 77092-4542, DarriL (Jan2074-Feb2078))
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  4. #4
    Thank you Greg and Paul. I started seriously trying learn VBA about 1.5 months ago and thanks to this forum, I am miles away from where I started (low bar, but still).

    Seriously wish I could buy you guys beers.

  5. #5
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,340
    Location
    You're welcome. I would seriously enjoy one!
    Greg

    Visit my website: http://gregmaxey.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •