#! /usr/bin/perl
#Nisus Macro Block #source clipboard #destination clipboard #before execution #Copy #after execution #Paste #End Nisus Macro Block
### dochemsubscripts.pl
# dochemsubcripts.pl -- perl script to sniff out molecular formulas in an # RTF file and insert subscript tags for the numbers, superscript tags for # ionic signs. JL 8/2003
@myfile=<STDIN>;
foreach $s (@myfile){
$s=~s/([A-Z][a-z]?[0-9]*)([+-])/$1\{\\super $2\}/g;
$s=~s/\)([+-])/\)\{\\super $1\}/g;
$s=~s/([A-Z][a-z]?)([0-9]+)/$1\{\\sub $2\}/g;
$s=~s/\)([0-9]+)/\)\{\\sub $1\}/g;
print $s;
}# end of script
Please feel free to try this out. (Feedback appreciated!)
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]
