Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regular Expressions, Where are they?

 
Warren Bell
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Peter Tran
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ivan Tamayo
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Handle of regular expression comes with Java SDK 1.4. �The Java CookBook includes examples on this?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic