Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Mar 2001
    Posts
    165
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to do search for hyphens

    I'm using Word 2010 (Windows 7). I converted a PDF to Word and I'm trying to clean things up. I have a lot of words with hyphens in the middle of them that shouldn't be there. What sort of an expression would I use to search for these and replace what I find, minus the hyphen? Thanks.
    Clark

  2. #2
    Silver Lounger
    Join Date
    Mar 2014
    Location
    Forever West
    Posts
    2,078
    Thanks
    0
    Thanked 259 Times in 248 Posts
    If it were me I'd just use the Edit, Find and Replace feature to delete the hyphens. Even with an expression or macro there will still remain the issue of whether the hyphen should actually exist in some instances, hopefully spell check or grammar check will see those.

  3. #3
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Clark,

    You can use the following regular expression in the Find what: box
    Code:
    (<[a-z,A-Z]*>)(-)(<[a-z,A-Z])
    And this in the Replace with: box
    Code:
    \1\3
    Make sure to check the Use wildcards check box.
    FindandReplaceRegEx.JPG

    Of course you'll try this on a COPY of your document!


    HTH
    Last edited by RetiredGeek; 2015-07-05 at 10:29.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  4. #4
    4 Star Lounger
    Join Date
    Jun 2011
    Location
    Hampshire (the old one)
    Posts
    525
    Thanks
    21
    Thanked 72 Times in 62 Posts
    If you don't have any hyphens that you do want, just put a hyphen in the Find box and leave the Replace box blank. All hyphens will be replaced with...er, nothing.

  5. #5
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    For a fully-fledged macro to clean up such documents, see: http://windowssecrets.com/forums/sho...l=1#post859582
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  6. The Following User Says Thank You to macropod For This Useful Post:

    Charles Kenyon (2015-07-06)

Posting Permissions

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