[2233] in java-interest

home help back first fref pref prev next nref lref last post

Re: regular expressions in Java(2)

daemon@ATHENA.MIT.EDU (Christophe Meessen)
Wed Sep 27 07:46:40 1995

Date: Wed, 27 Sep 1995 10:09:14 +0100
To: Glen.Perkins@nativeguide.com (Glen C. Perkins), java-interest@java.sun.com
From: meessen@cppm.in2p3.fr (Christophe Meessen)

Sorry hit the wrong key. Here is the full message...

At 16:43 26/09/95 -0700, Glen C. Perkins wrote:
>
>>From: tmb@best.com
>>Date: Sun, 24 Sep 1995 23:56:40 -0800
>>Subject: regular expressions and dbm for Java?
>>
>>Languages like Perl and Python that are currently popular for doing
>>a lot of WWW related programming have extensive support for
>>regular expressions and dbm files.
>>
>>I'm sort of missing similar support in Java.  Is there a standard
>>API and implementation in the works?
>>
>>Thomas.
>>
>
>Several people have pointed out how valuable unicode-savvy regular
>expressions would be to Java, but the Java team never responds to this
>question. I wish they would.
...

I'm working on writing one.
I've actualy wrote a simple globbing function.
I've also wrote a string search function that uses the BM search algorithm.

I totaly agree with the key role of the regexp or regsub command.
In tcl I use it alot.

There are two solution:

1. use the freeware C source that Henry Spencer shared with us 1986.
This is the one used in FeeeBSD, Tcl and I guess in many other freeware
packages like Perl.

2. rewrite it in java so it is portable and doesn't need to be part of the
standard java package.
 
Using native methods would make it efficient but refrain portability.
In that case the only reasonable solution is to make it part of the 
standard java library. this would add more work for people porting java on
new plateform. regexp is very portable though.

I looked at the Tcl regexp code and compare it to the FreeBSD verstion.
There are not that much changes. So I guess it could be rapidely turned into
a native
class.

I see a simple class with one constructor, receiving the regular experession
as argument. A match method receiving the String to search in. The result
would be an array of Strings matching the regular expression parenthezised
parts. cf Tcl.

The Spemcer regexp is not the same as System V (unix) regexp. It is a more
simple one. I would say also much less complex to learn and use.
Once learned it is very powerful. I think it is a key function to add in the
java.util package.

I will try to make the native class. Depends of the "free" time I have.
Any help is welcome. unless sun.java.team tells me they are working on it.

Bien cordialement,

Ch.Meessen

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post