Is there a way to use FIND to highlight all text that has a dash (hyphen) to the left or right of it? Example of things I need to highlight:
2-11-3
4-7-1
19-20-4, 6-1-1
7-4-2I don't know if there is a wildcard formula that lets me highlight all occurances of these. Maybe something that follows the logic of "Highlight all to the left or right of a hyphen" or something like that?
OK, it took a bit of fiddling with the numbers,
but this seems to give you what your looking for:<[0-9]{1,99}-[0-9]{1,99}-[0-9]{1,99}
See how it works for you.
Try this: Open your Word doc,
On the ribbon select Home Tab
Select Find
In the Find Box, on the lower left, select More
Check the box next to Use Wildcards
In the Find What box at the top enter any one of the following three:Character to the Left of a Dash: ?-
Character to the Right of a Dash: -?
Character to the both the Left & Right of a Dash: ?-?
The question mark is a wild card that matches any Single Character.
message edited by mmcconaghy
Just in case you need it, the wild card for multiple characters is the star * In your example you have sets of three characters
separated by two dashes
so something like: *-*-* should work to highlight each group.message edited by mmcconaghy
"*-*-* should work " Close, but I'm afraid it didn't get the whole string:
https://i.imgur.com/f48Oe4f.jpg
"Character to the both the Left & Right of a Dash: ?-?"I tried this, but I'm afraid it's only limited to one character.
https://i.imgur.com/fjEdD9N.jpg
We're getting close, though. Any help appreciated.
I don't think you should expect the Find function to
highlight the entire string of characters. It should be
enough that it finds all of the strings for you and doesn't
miss any. You then will have to select the part of each
string that you want.
The more variety there is in how the characters can be
strung together, the more rules are needed to select
exactly what you want. When I've done searches like
this, I have generally made several passes, one pass
for each rule. Maybe I could have combined some of
the rules together to make fewer passes.
-- Jeff, in Minneapolis
What is it your actually trying to do?
There may be other way to accomplish what your really trying to do.I don't think there is an easy way to select all the strings you want, because in addition to the dash's and numbers you have a comma, as well as line break characters and/or paragraph marks that need to be accounted for.
The hard part of using Wild Cards is telling it when to Stop searching.None of the several ways I have tried works consistently over the whole document.
This finds the beginng & end of the "word", ie your string of characters: <*-*-*>
This one adds a Line break character to the end: <*-*-*>^|
This one a paragraph mark: <*-*-*>^p
But none of these account for the string separated by the comma.
As Jeff Root pointed out:
The more variety there is in how the characters can be
strung together, the more rules are needed to selectHere are a couple of sites on how to use Wild Cards:
https://www.officetooltips.com/word...
http://wordfaqs.ssbarnhill.com/Nonp...
message edited by mmcconaghy
Here is another one that almost works, but misses the one before the comma: <[1-9]{1,2}-[1-9]{1,2}-[1-9]{1,2}>
OK, it took a bit of fiddling with the numbers,
but this seems to give you what your looking for:<[0-9]{1,99}-[0-9]{1,99}-[0-9]{1,99}
See how it works for you.
<[0-9]{1,99}-[0-9]{1,99}-[0-9]{1,99} It works!
Thankyou so much, mmcconaghy. This is the perfect, quick n' elegant solution I needed that makes my job lightning faster. Thankyou so very much!