MiamiGenome has asked for the wisdom of the Perl Monks concerning the following question:
---- Here are my attempts, using @wordlist to hold the substrings (several variations omitted) :# Input @terms = qw/Genetics Genomics phylogeny allele ChromosomeLocusLink geneExpression RasSignalTransductionPathway/; foreach my $words (@terms) { my @wordlist = $words =~ /(?:(.+?[a-z])([A-Z].+))+/g; } # Desired Result @separated_terms = qw/Genetics Genomics phylogeny allele Chromosome Locus Link gene Expression Ras Signal Transduction Pathway/;
# does not work - removes last lowercase and first uppercase letter at + each boundary # my @wordlist = split /[a-z][A-Z]/, $words; # does not work - only separates the last term from the list my @wordlist = $words =~ /(?:(.+?[a-z])([A-Z].+))+/g;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regular Expression - split string by lower/upper case
by davidrw (Prior) on Apr 14, 2006 at 18:25 UTC | |
by johngg (Canon) on Apr 14, 2006 at 20:08 UTC | |
by MiamiGenome (Sexton) on Apr 14, 2006 at 18:51 UTC |