Issue
I am working on a multi-language book, and I need to find and replace all hyphens with en-dashes that occur between numbers in the citations section. I need to avoid all hyphens that exist between roman letters.
If I use a GREP [0-9]-[0-9] it selects the numbers before and after the hyphen and I have to manually select the hyphen and replace it with an en-dash. This is labor intensive.
Is there a way for me to find the hyphen that exists between the numbers, but EXCLUDE the numbers themselves from being highlighted? This way I can run a the Find and Replace to change what will probably be 1000+ manual changes?
I tried using GREP [0-9]-[0-9] to find the hyphens, but then couldn't find a way to have the find and replace keep the existing numbers.
Solution
That's what lookaheads and lookbehinds are for`
(?<=[0-9])-(?=[0-9])
Answered By - cybernetic.nomad Answer Checked By - Marilyn (WPSolving Volunteer)