Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How do I remove unwanted hyphens from some text I have copied out of a PDF into Word. The criteria is that I would like to remove any hyphen that does not have a space either to its left or right.

Currently, the words look like this because of the way they have been copied: The qui-ck brown fox- jumps o-ver the lazy dog. By the end, I only want the hyphen between fox and jumps to survive.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Try putting this into the Find box: [! ]-[! ] (note the spaces after the !) Make sure that "Use Wildcards" is checked.

Explanation:

[! ] Any non-space character. The [ and ] characters group patterns together while the ! negates it.

- This is the literal character -

So [! ] - [! ] is a - with non-space characters on either side.

Example character string that matches: foo-bar

Example character strings that do not match: foo- bar foo - bar foo -bar foobar, etc.

share|improve this answer
    
Can you please explain this? What does it do, what rules does it use? –  wizlog Mar 20 '12 at 20:22
    
It makes use of the wildcard support in Notepad++. Essentially, it matches any sequence of characters that follow the pattern <Any Non-space character><literal '-'><Any Non-space character> –  Andrew Lambert Mar 20 '12 at 23:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.