Using Grep {expStr, reverse} with more than one expStr parameter

Hi, this is resolved. Just leaving it here in case someone finds the query useful. 

 

Query:

I have a chemical formula wave. Let's say the cells have CxHyOr, CxHyNzO, CxHyN, CxHySc, CxHyNzSc, CxHyOrSc, CxHy as values where CHNOS are chemical elements and x,y,z,c,r are numerals.  

I need to Grep to produce a W_Index that: 

-excludes formulas containing both O and S. 

-excludes formulas containing both N and O. ..etc. 

I can do this operation smoothly using the reverse operator if only one element needs to be excluded: Grep/INDX/Q/E={"N",1} formulawave (for example to exclude all formulas with N in them)

However, I cannot figure out from anywhere how to do this if my exclusion parameter includes more than one element. For example, if I want W_Index for only the formulas that contain CHS elements but no N or O. If I were to do {"S",0}, the output will include all of CHS, CHNS, CHOS formulas but I just need CHS. 

There can be messy ways of doing this but can Grep work with more than one exclusion parameter? Or any other inbuilt function in IGOR? 

Sincerely, 

"N.*O|O.*N" (credits: Tony)

 

I also ended up doing: 

Grep/indx/q/e={"[NO]",1} formulawave 

to exclude all formulas containing N or O. 

> Regex has changed my life! 

I understand that there is an active support group for this malady. Entrance is granted at the invocation of an otherwise hidden, magic REGEX escape code sequence. I have yet to discover it, and reporting it in public otherwise has rather serious penalties as I am told.

Heh. I like that, Jeff. As they say:

"I have a problem."

"Oh, look, regular expressions can solve it"

Now you have two problems...