jakarta-oro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Davey - Sun UK Support Engineer <michael.da...@Sun.COM>
Subject Re: m//g and pos
Date Tue, 19 Feb 2002 20:04:35 GMT
I would also like to do...

$grafitto = "fee fie foe foo";
pos $grafitto = 4; # Skip the fee, start at fie
while( $grafitto =~ m/e/g ) {
    print pos $grafitto, "\n";
}

I guess I could get a substring and do work with that,
adding 4 to all the results.

"Daniel F. Savarese" wrote:
> 
> In message <3C7221E6.E8C6EE7E@Sun.COM>, Michael Davey - Sun UK Support Engineer
>  writes:
> >However, it might be nice to implement the m//g
> >and pos functionality in ORO itself.  Is this
> >worth doing?
> 
> This is what PatternMatcherInput is for.  You would reproduce
> 
> $grafitto = "fee fie foe foo";
> while( $grafitto =~ m/e/g ) {
>     print pos $grafitto, "\n";
> }
> 
> with
> 
> pmi.setInput("fee fie foe foo");
> while(perl.match("m/e/", pmi)) {
>    System.out.println(pmi.getMatchEndOffset());
> }
<snip>

--
To unsubscribe, e-mail:   <mailto:oro-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:oro-dev-help@jakarta.apache.org>


Mime
View raw message