Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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.


[! ] 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .