Jonathan,
Maybe I've got my e-mails mixed up but I have the following as your original script (dated Aug 16, 2003 on the list):
@myfile=<STDIN>;
foreach $s (@myfile){
1. $s=~s/([A-Z][a-z]?[0-9]*)([+-])/$1\{\\super $2\}/g;
2. $s=~s/\)([+-])/\)\{\\super $1\}/g;
3. $s=~s/([A-Z][a-z]?)([0-9]+)/$1\{\\sub $2\}/g;
4. $s=~s/\)([0-9]+)/\)\{\\sub $1\}/g;
print $s;
}
This script did not handle all superscripts correctly so I revised line 1 to look like what you have below in line 2. Then I added a new line one, giving a new script which had 5 lines. This was my first revision, which I posted to the list. It worked on all formulas except formulas like Cu(H2O)62+. A few hours later I added a 6th line which is the line 4 you mentioned below and it now handled all formulas correctly.
Yes. I should have gone back to my first letter when referring to the "original script." Sorry! Anyhow, I'm glad that the script is now working properly, regardless of who wrote what.
Jonathan
--------------------------------------------------- The Nisus Interactive List [EMAIL PROTECTED]
Searchable archives: http://www.mail-archive.com/nisus-interactive%40nisus.com/
To unsubscribe from this list please send a message with "unsubscribe nisus-interactive" in the body of the email to [EMAIL PROTECTED]
