On Friday, August 15, 2003, at 4:38 PM, Jonathan Levi MD wrote:


3. Perl script "dochemsubscripts.pl"

#!/sw/bin/perl
# dochemsubcripts.pl -- perl script to sniff out molecular formulas in an
# RTF file and insert subscript tags for the numbers. JL 8/2003


@myfile=<STDIN>;
foreach $s (@myfile){
        $s=~s/([A-Z][a-z]?)([0-9]+)/$1\\sub $2\\nosupersub /g;

A safer way to do this would be:


$s=~s/([A-Z][a-z]?)([0-9]+)/$1\{\\sub $2\} /g;

Whenever you want to turn on an attribute for some text, the best way to do it is to wrap the text in curly brackets ({}). What happens with this is any attribute changes you make inside the brackets will automatically revert to their previous state outside of the brackets.

-Charles


--------------------------------------------------- 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]




Reply via email to