You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oro-user@jakarta.apache.org by Jonathan Franzone <jo...@franzone.com> on 2001/12/04 00:07:34 UTC

Perl5Util Substitute and Backslash

*This message was transferred with a trial version of CommuniGate(tm) Pro*



I just started using this package and encountered this problem. I'm trying
to create a very basic RTF to Text converter that just uses regular
expressions to replace RTF control sequences. Anyway, the most basic one is
a paragraph control sequence "\par". I started with this code:

Perl5Util util = new Perl5Util();
String line;
while ((line = fin.readLine()) != null) {
  line = util.substitute("s/\\par /\r\n/g", line);
  System.out.println(line);
}

which I would expect to replace all occurrences of "\par " with "\r\n", but
it ends up replacing "\par " with "\\r\n". Essentially it is not replacing
the first backslash in the search regexp, almost like it starts the
substitution with the second character of the match. Any help is greatly
appreciated. Thanks!

Jonathan Franzone




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