Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: String Regex Methods

In addition the the Pattern and Matcher classes, there is some support for regular expressions in the String class.

Tutorial Details:

In addition the the Pattern and Matcher classes, there is some support for regular expressions in the String class.

boolean b;
String s, s2, t;
String regex;
String[] sa;

b = s.matches(regex) True if regex matches the entire string in s. Same as Pattern.matches(regex, s)
s2 = s.replaceAll(regex, t) Returns a new string by replacing each substring in s that matches regex with t
s2 = s.replaceFirst(regex, t) Replaces first substring in s that is matched by regex with String t


 

Rate Tutorial:
http://www.roseindia.net/java/java-tips/data/strings/40regular_expressions/10regex-string.shtml

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
String Regex Methods

View Tutorial:
String Regex Methods

Related Tutorials:

Create forward-compatible beans in EJB, Part 2 - JavaWorld January 2000
Create forward-compatible beans in EJB, Part 2 - JavaWorld January 2000
 
Dynamic user interface is only skin deep - JavaWorld May 2000
Dynamic user interface is only skin deep - JavaWorld May 2000
 
Debug with jdb - JavaWorld June 2000
Debug with jdb - JavaWorld June 2000
 
Make an EJB from any Java class with Java Reflection - JavaWorld December 2000
Make an EJB from any Java class with Java Reflection - JavaWorld December 2000
 
Design for performance, Part 1: Interfaces matter - JavaWorld January 2001
Design for performance, Part 1: Interfaces matter - JavaWorld January 2001
 
Design for performance, Part 2: Reduce object creation - JavaWorld February 2001
Design for performance, Part 2: Reduce object creation - JavaWorld February 2001
 
A primordial interface? - JavaWorld March 2001
A primordial interface? - JavaWorld March 2001
 
XML APIs for databases - JavaWorld January 2000
XML APIs for databases - JavaWorld January 2000
 
Build secure network applications with SSL and the JSSE API - JavaWorld May 2001
Build secure network applications with SSL and the JSSE API - JavaWorld May 2001
 
Device programming with MIDP, Part 3 - JavaWorld July 2001
Device programming with MIDP, Part 3 - JavaWorld July 2001
 
Explore the Dynamic Proxy API
Explore the Dynamic Proxy API
 
I want my AOP!, Part 2
I want my AOP!, Part 2
 
XML documents on the run, Part 2
XML documents on the run, Part 2
 
Java's character and assorted string classes support text-processing
Java's character and assorted string classes support text-processing
 
TRMI
TRMI
 
Java Tip 143: Utilize the Database Schema Browser
Java Tip 143: Utilize the Database Schema Browser
 
Once again, only introduction
Once again, only introduction
 
Object equality
Object equality Writing equals and hashCode methods for data objects Summary In this article, Alex Blewitt describes the two most common methods in the Java language—equals() and hashCode()—and shows how they can be implemented correctly. The
 
Understanding the Interplay Between Utility Classes and Static Initialization
Java is an OO language, which means much of the functionality of a Java application is encapsulated into cohesive classes that can be instantiated and acted upon.
 
Smokescreen 3.4 has been released
Smokescreen is a Java obfuscator. Aside from being able to change symbolic names, it can also modify the bytecode instructions in methods thereby obfuscating control flow. This makes the resulting obfuscated classes much more difficult to decompile.
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.