Is There A Way To Delete Unnecessary Hyphens?
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
Is There A Way To Delete Unnecessary Hyphens?
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?
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?
Re: Is There A Way To Delete Unnecessary Hyphens?
You can do a replace operation like so: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.
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
Re: Is There A Way To Delete Unnecessary Hyphens?
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.ak47wong wrote:You can do a replace operation like so: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.
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 again for trying to help me out.
Bob
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
- Bob Hansen
- Posts: 1516
- Joined: Sun Mar 02, 2003 8:15 pm
- Location: Salem, NH
- Contact:
ak47wong did provide you with a solution that matched exactly what you requested:
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
-----------------------------------------
.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
Bob
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.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.
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
- Bob Hansen
- Posts: 1516
- Joined: Sun Mar 02, 2003 8:15 pm
- Location: Salem, NH
- Contact: