Page 1 of 1
Is There A Way To Delete Unnecessary Hyphens?
Posted: Sat Jan 09, 2010 4:32 pm
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?
Re: Is There A Way To Delete Unnecessary Hyphens?
Posted: Sat Jan 09, 2010 5:24 pm
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
Re: Is There A Way To Delete Unnecessary Hyphens?
Posted: Sat Jan 09, 2010 5:53 pm
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
Posted: Sat Jan 09, 2010 6:53 pm
by ben_josephs
Find what: ([bcdfghjklmnpqrstvwxyz])-\1
Replace with: \1\1
[X] Regular expression
Replace All
Posted: Sat Jan 09, 2010 6:54 pm
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
-----------------------------------------
Posted: Sat Jan 09, 2010 7:27 pm
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.
Posted: Sat Jan 09, 2010 7:40 pm
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.
Posted: Sat Jan 09, 2010 8:09 pm
by ben_josephs
It does work. Try again.
Make sure you haven't got a space at the end of the search expression.
Posted: Sat Jan 09, 2010 8:35 pm
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.
Posted: Sun Jan 10, 2010 3:29 am
by Bob Hansen
Ben's solution was neater than mine.
But I am curious if mine did not work for you?