gnu-regexp-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Regexp] Q: calling functions with the match ?


From: Wes Biggs
Subject: Re: [Regexp] Q: calling functions with the match ?
Date: Wed, 26 Feb 2003 12:31:34 -0800
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130

Mark --

This has been discussed and some interfaces have been proposed, but the functionality is currently not available in gnu.regexp.

Of course, you've got the source, so if you need to make match() public, be my guest. :-)

Wes

Mark Müller wrote:
hi all,
i use the following code to pre process a xml file to make it "more" xml
conform:

    FileInputStream f = new FileInputStream(fileName);
    InputStreamReader isr = new InputStreamReader(f);
    RE re = new gnu.regexp.RE("<(br|b|i|tt|BR|B|I|TT)>");
    REFilterReader fr = new REFilterReader(isr, re, "&lt;$1&gt;");
    RE re2 = new gnu.regexp.RE("</(br|b|i|tt|BR|B|I|TT)>");
    REFilterReader fr2 = new REFilterReader(fr, re2, "&lt;/$1&gt;");

I would also like to encode special characters like i would do it with
perl:

    $content =~ s/([\176-\377])/ '&#' . ord($1) . ';'/esg;

Is it possible with the java gnu regexp package to call a function with
the match?
I tried to write a sub class of the REFilterReader which does something
but the members like match are not visible to public...

Best Regards,
Mark






reply via email to

[Prev in Thread] Current Thread [Next in Thread]