in reply to Regular Expression to find Word Prefixes
Though, if you cannot make that assumption, but you can make the assumption that the actual chemical names never have a space in them, you can use japhy's sexeger techiniques. That is, reverse the string and apply the regex there.
Jeremy#!/usr/bin/perl -w use strict; my @data = ('12 chem1', '1/2 chem2', '(N+1) chem3', '2M chem4', 'N chem5'); my $chem; foreach (@data) { $chem = reverse $_; $chem =~ s/^\S+//; $chem = reverse $chem; print $chem . "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regular Expression to find Word Prefixes
by Juerd (Abbot) on May 19, 2002 at 19:01 UTC | |
|
Re: Re: Regular Expression to find Word Prefixes
by arunhorne (Pilgrim) on May 19, 2002 at 21:39 UTC |