View RSS Feed

Java String

How Are Regular Expressions Represented?

Rate this Entry
by , 04-26-2012 at 06:45 PM (408 Views)
Package java.util.regex has three classes: PatternSyntaxException, Matcher and Pattern.

  • Pattern object is basically the compiled presentation of regular expression. For pattern creation first thing is invoking public static methods of compilation that will make pattern object to be returned. Regular expression is accepted by these methods being 1st argument; 1st trial lessons will let you know regarding the required syntax.
  • Matcher object is considered to be an engine which will be interpreting patterns. Also, match operations are being performed for input string. Matcher doesn’t define any public constructors. Matcher object is obtained when matcher method is invoked at pattern object.
  • PatternSyntaxException is basically unchecked kind of exception which shows sytax errors present in regular expression.



Few last trial lessons explore out all classes in detail. However, first of all one shall understand that how to construct the regular expressions. Hence simpler test harness will be introduced in next section which will repeatedly be used for their syntax exploring.

Submit "How Are Regular Expressions Represented?" to Facebook Submit "How Are Regular Expressions Represented?" to Digg Submit "How Are Regular Expressions Represented?" to del.icio.us Submit "How Are Regular Expressions Represented?" to StumbleUpon Submit "How Are Regular Expressions Represented?" to Google

Categories
Regex

Comments