You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oro-dev@jakarta.apache.org by "Daniel F. Savarese" <df...@savarese.org> on 2002/02/19 17:33:07 UTC

Re: m//g and pos

In message <3C...@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());
}

daniel



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: m//g and pos

Posted by Michael Davey - Sun UK Support Engineer <mi...@Sun.COM>.
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 <3C...@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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>