Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

java.util.regex.* --how it works!?

Status
Not open for further replies.

duan

Technical User
May 30, 2001
9
GB
Hi,Dear

i'm working on processing the text using Java. I found java.util.regex.* can deal with Regular Expression which will enable me split the text as easy as effcient.

Drop several lines of the test code on it:

------------------------------------------------------------
String line = "ameba S_CL,S_EN,S_PN the second word in the array end2";

Pattern p = Pattern.compile("S_*");
Matcher m = p.matcher(line);
boolean b = m.matches();
System.out.println("find the patterns in the string?" + b);
------------------------------------------------------------

The error is "package java.util.regex.* does not exit"
How can I import it?

Seconde quetion is : does anybody know some examples on it? or any experience on it? or Where can I get more info. on it?

Thanks very much.

duan



 
This package requires JDK 1.4 - the java.util.regex package does not exist before that, as your compiler already noticed :)

Look at the following URL to be able to download the 1.4 JDK (still beta!):


You may have to be logged in to the Developer Connection. And: The download is pretty big (46 Megs).

Sorry, I have no experience with the package - just right now downloading the beta 1.4 ;-)
allow thyself to be the spark that lights the fire
haslo@haslo.ch - www.haslo.ch​
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top