Skip to main content
kara_co2meter
Participant
January 18, 2021
Answered

GREP Style Help - Subscripting Chemical Formulas

  • January 18, 2021
  • 2 replies
  • 1359 views

Hello there! 

I'd like to create a GREP script for a project I'm working on. This particular document is going to be talking about CO2, N2, and CH4. I would like those numbers to be subscripted. Here's the kicker though...the company I work for, CO2Meter, is also mentioned in this document. I DON'T want that 2 to be subscripted. Below is a script I've found that is working for the subscripting. I just need to add in how to NOT have the '2' in CO2Meter get subscripted. Any suggestions would be incredibly helpful!

 

((?<=Na|Cl)|(?<=H|C|O|S|N))\d{1,3}(?!\d)

This topic has been closed for replies.
Correct answer jctremblay

Change (?!\d) at the end for (?!\d|Meter)

2 replies

Participant
February 5, 2024

Hi Kara,
can you share you script ? I'm interested.

thanks

jctremblay
Community Expert
jctremblayCommunity ExpertCorrect answer
Community Expert
January 18, 2021

Change (?!\d) at the end for (?!\d|Meter)

kara_co2meter
Participant
January 18, 2021

You, my friend, are a lifesaver! Thank you so much.