For the broader scope of my challenge-at-hand, I have been looking for a usable InDesign GREP statement to help automate the conversion of serial commas from the non-Oxford style to the Oxford comma (and vice versa).
For the purposes of simplifying this question for the SE community I will limit the challenge to using GREP to FIND non-Oxford style commas.
I have used two expressions, both of which draw in too much content:
- from my own development:
,(.*?),(.*?) and (.*?)
Result:
, and the possibility of detecting signs of life, biomarkers, occupies the thoughts of many researchers. Such measurements may be possible with the next generation of large aperture optical telescopes. Looking back to the Big Bang, we are now on the verge of measuring the impact of gravitational waves generated by quantum effects during the Inflationary epoch, an era when the Universe expanded at unprecedented rates. Aside from generating important new knowledge, modern astronomy both utilizes and
from an InDesign user forum:
(?<=\w,)(.+)(.*?)(?= and)
Result:
and the possibility of detecting signs of life, biomarkers, occupies the thoughts of many researchers. Such measurements may be possible with the next generation of large aperture optical telescopes. Looking back to the Big Bang, we are now on the verge of measuring the impact of gravitational waves generated by quantum effects during the Inflationary epoch, an era when the Universe expanded at unprecedented rates. Aside from generating important new knowledge, modern astronomy both utilizes
As you can see neither result picks up a serial comma and both are too broad to be effective.
I've struggled with this, but can not find a reasonable solution on the Web. I thought I would ply the great minds of the SE community, including coders of regex and users of other GREP tools.
I thank you in advance for your time.