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

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

[Regexp] Q: calling functions with the match ?


From: Mark Müller
Subject: [Regexp] Q: calling functions with the match ?
Date: Thu, 20 Feb 2003 12:13:56 +0100

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 

-- 
Das Büro am Draht GmbH | Blücherstraße 22 | D-10961 Berlin
+49 30 690355-0 | Fax +49 30 690355-33
address@hidden | http://www.dasburo.com

Mark Müller | Software-Ingenieur




reply via email to

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