Hi,
I was thinking of extending ORO to support the /g
modifier and pos command. /g does a global match
and can be written in user code.
pos returns the offset of the firsst character after
the last match (as endOffset() does). This is where
the next m//g match will start. pos can also be used
to change where the next m//g match will start.
For instance, the Perl snippet:
$grafitto = "fee fie foe foo";
while( $grafitto =~ m/e/g ) {
print pos $grafitto, "\n";
}
Can be implemented in ORO as:
public void testPos() {
String grafitto = "fee fie foe foo";
int i = 0;
while ( __perl.match( "m/e/", grafitto ) ) {
i += __perl.endOffset( 0 );
System.out.println( i );
grafitto = __perl.postMatch();
}
}
However, it might be nice to implement the m//g
and pos functionality in ORO itself. Is this
worth doing?
Where would one make the changes, in Perl5Util or
in the underlying OROMatcher libraries?
(technically, either is possible).
--
Michael
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>