Is There A Way To Delete Unnecessary Hyphens?

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Grizzly
Posts: 14
Joined: Thu Aug 14, 2003 9:23 pm

Is There A Way To Delete Unnecessary Hyphens?

Post by Grizzly »

In texts that I receive from others, there are often hyphenated words that appeared at the end of a line in their word processor or text editor, but which aren't at the end of a line for my configuration. It's easy to change "-ing" to "ing" for instance, but when a word such as "grabbing" is present, the break is between the two consonants, so I wind up with "grab-bing." If I could search for a sequence where a hyphen/dash is inserted between two consonants and replace with those same two consonants, then my world would be ever so much brighter. :)

Is there a way to do that without setting up a macro that would search for 20+ possible combinations and correcting these hyphens that way?
ak47wong
Posts: 703
Joined: Tue Aug 12, 2003 9:37 am
Location: Sydney, Australia

Re: Is There A Way To Delete Unnecessary Hyphens?

Post by ak47wong »

Grizzly wrote:If I could search for a sequence where a hyphen/dash is inserted between two consonants and replace with those same two consonants, then my world would be ever so much brighter.
You can do a replace operation like so:

Find what: ([bcdfghjklmnpqrstvwxyz])-([bcdfghjklmnpqrstvwxyz])
Replace with: \1\2

Select the "Regular expression" option in the Replace dialog.
Clear the "Match case" option (if you select it, this will only work for lower-case and not upper-case consonants).
Select the "Use POSIX regular expression syntax" option in the Preferences dialog.

Andrew
Grizzly
Posts: 14
Joined: Thu Aug 14, 2003 9:23 pm

Re: Is There A Way To Delete Unnecessary Hyphens?

Post by Grizzly »

ak47wong wrote:
Grizzly wrote:If I could search for a sequence where a hyphen/dash is inserted between two consonants and replace with those same two consonants, then my world would be ever so much brighter.
You can do a replace operation like so:

Find what: ([bcdfghjklmnpqrstvwxyz])-([bcdfghjklmnpqrstvwxyz])
Replace with: \1\2

Select the "Regular expression" option in the Replace dialog.
Clear the "Match case" option (if you select it, this will only work for lower-case and not upper-case consonants).
Select the "Use POSIX regular expression syntax" option in the Preferences dialog.

Andrew
Thanks Andrew. I sincerely appreciate it, and I tried it out, but I need to match up only a "b" with a "b," a "c" with a "c", etc., etc. The expression above matched every possible instance of a hyphen between any two (random) consonants and deleted all the hyphens in the text file. :(
Thanks again for trying to help me out.

Bob
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Find what: ([bcdfghjklmnpqrstvwxyz])-\1
Replace with: \1\1

[X] Regular expression

Replace All
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

ak47wong did provide you with a solution that matched exactly what you requested:
If I could search for a sequence where a hyphen/dash is inserted between two consonants
.

But now you have changed the specs.
Here is a structure that you can complete:

Search for (b)-(b)|(c)-(c)|(d)-(d)|.......|(z)-(z)
Replace with \1\2

Continue after "d" with the consonants as shown in the original solution.

Use the following settings:
-----------------------------------------
[X] Regular expression
Replace All
-----------------------------------------
Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
-----------------------------------------
Last edited by Bob Hansen on Sun Jan 10, 2010 3:30 am, edited 1 time in total.
Hope this was helpful.............good luck,
Bob
Grizzly
Posts: 14
Joined: Thu Aug 14, 2003 9:23 pm

Post by Grizzly »

Bob Hansen wrote:ak47wong did provide you with a solution that matched exactly what you requested:
If I could search for a sequence where a hyphen/dash is inserted between two consonants
.

But now you have changed the specs.
Here is a structure that you can complete:

Search for (b)-(b)|(c)-(c)|(d)-(d)|.......|(z)-(z)
Replace with \1\2

Continue after "d" with the consonants as shown in the original solution.
I'm sorry for not accurately defining the problem. When I wrote, "If I could search for a sequence where a hyphen/dash is inserted between two consonants and replace with those same two consonants, then my world would be ever so much brighter." I thought I was being clear, but I guess not. Again, I apologize.
Grizzly
Posts: 14
Joined: Thu Aug 14, 2003 9:23 pm

Post by Grizzly »

ben_josephs wrote:
Find what: ([bcdfghjklmnpqrstvwxyz])-\1
Replace with: \1\1

[X] Regular expression

Replace All

Thanks, Ben, I tried this but that sequence doesn't find anything. I do appreciate you replying though.

Please disregard my question. I'll solve the problem using another text editor.
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

It does work. Try again.

Make sure you haven't got a space at the end of the search expression.
Grizzly
Posts: 14
Joined: Thu Aug 14, 2003 9:23 pm

Post by Grizzly »

ben_josephs wrote:It does work. Try again.

Make sure you haven't got a space at the end of the search expression.
Thank you very much. It does work.
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Ben's solution was neater than mine.

But I am curious if mine did not work for you?
Hope this was helpful.............good luck,
Bob
Post Reply