Regular Expressions, Where are they?

Warren Bell

Ranch Hand

Posts: 56

posted 16 years ago

Are there any regular expression capabilities in Java. I am looking for a simple way to replace text in a string. For example, replace every word that starts with "a" and ends in "a" with the word "replaced". The String and String Buffer classes can do this, but not without a lot of work. Thanks, ------------------ Warren Bell

Warren Bell

Peter Tran

Bartender

Posts: 783

posted 16 years ago

Warren, If you can work on JDK1.4 beta, you can look into java.util.regex class. See this excellent article. -Peter

Peter Tran

Bartender

Posts: 783

posted 16 years ago

Another good regex package is the Jakarta Regexp package. That's what we use for now, since JDK 1.4 Beta is too bleedy edge. -Peter