Hi. (I'm the new guy in the list, just discovered regexp, blah blah blah)

I've been tinkering around with Regexp, and there's one thing that calls my
attention: in order to obtain whatever the last regexp match was, one must
use r.getParen(0) (with r being a RE class, etc.). I find this... not
intuitive/clear enough. I'd rather have a method called getMatched() that
would do the same thing.

So, I added it to the RE class. It's actually extremely simple:

    public String getMatched()
    {
        return getParen(0);
    }

There. It's not much, but I think it's much clearer to read code that goes:

if (r.match(address)) { System.out.println("We got: "+r.getMatched()); }

than

if (r.match(address)) { System.out.println("We got: "+r.getParen(0)); }

, for example.


I'll probably post more nitpicks as I keep tinkering.



--
To unsubscribe, e-mail:   <mailto:regexp-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:regexp-user-help@;jakarta.apache.org>

Reply via email to