View RSS Feed

Java String

Using Regular Expressions with String.matches()

Rate this Entry
by , 04-26-2012 at 06:44 PM (461 Views)
Built in support is provided by Strings present in Java for the regular expressions. There are 3 built in methods present in Strings for regular expressions. For example: replace(), split() and matches().

There is no optimization of methods for performance. Classes will be used later on, which are performance optimized.

s.matches("regex"): Evaluates if "regex" matches s. Returns only true if the WHOLE string can be matched
s.split("regex"):C reates array with substrings of s divided at occurance of "regex". "regex" is not included in the result.

Submit "Using Regular Expressions with String.matches()" to Facebook Submit "Using Regular Expressions with String.matches()" to Digg Submit "Using Regular Expressions with String.matches()" to del.icio.us Submit "Using Regular Expressions with String.matches()" to StumbleUpon Submit "Using Regular Expressions with String.matches()" to Google

Categories
StringBuffer

Comments