You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oro-user@jakarta.apache.org by Rupinder Singh Mazara <rs...@ebi.ac.uk> on 2002/07/22 15:45:31 UTC
Newbee needs help
Hi all
I am a new user to ORO and need some help
I would like to execute the following perl code in java
$pages = something ;
if ($pages =~ /^(\d+)-(\d+)/){
($p1,$p2) = ($1,$2);
} elsif ($pages =~ /^(\d+)$/){
($p1) = $1;
} elsif ($pages =~ /^([A-Za-z]+)(\d+)$/){
($prefix,$p1) = ($1,$2);
} elsif ($pages =~ /^([A-Za-z]+)(\d+)-(\d+)$/){
($prefix,$p1,$p2) = ($1,$2,$3);
} elsif ($pages =~ /^([A-Za-z]+)(\d+)-(\1)(\d+)$/){
($prefix,$p1,$p2) = ($1,$2,$4);
} elsif ($pages =~ /^(\d+)([A-Za-z]+)-(\d+)(\2)$/){
($p1,$suffix,$p2) = ($1,$2,$3);
} elsif ($pages =~ /^(\d+)([A-Za-z]+)$/){
($p1,$suffix) = ($1,$2);
} else {
warn "Cant parse pages '$pages'";
}
What would be the best way to solve this ? :-(
I was considering using Perl4Util
but donot know how to access ($1,$2)
Rupinder