Friday 7 November 2014

Regular Expressions

      Regular Expressions
      Harness Program
      java.util.regex package
            Pattern class
      Regular Expression Syntax
      Regular Expression : Predefined character classes
            Match any Character with .
            Match any digit with \d
            Match any word character \w
      Regular Expression : Character classes
            Range Of Characters
            Negated Character classes
      Quantifiers
            Greedy quantifiers
            Reluctant quantifiers
            Possessive quantifiers
            Greedy, Reluctant, and Possessive Quantifiers
            ? : once or not at all
            * : Match zero or more times
            + : Match one or more times
      Logical operators
            Matching one of sub expressions
      Capturing Groups
            Naming a capturing group
      Backreferences
      Boundary Matchers
            Start(^) and End($) of the Line
      Word boundary
      Escape sequence
      regular expression to validate java variable name
      Exploring Pattern class
            Match input against pattern
            Compiling regular expression
            Creating a Pattern with Flags
            Pattern.CANON_EQ
            Pattern.CASE_INSENSITIVE
            Pattern.COMMENTS
            Pattern.DOTALL
            Pattern.LITERAL
            Pattern.MULTILINE
            Pattern.UNICODE_CASE
            Split the input based on the pattern
            Get regular expression from which this pattern was compiled
      Matcher class
            How to create Matcher instance
            matches() : Match entire input sequence
            lookingAt(): Match input sequence
            find() : Find all the matches in the input
            Get the Matched sequence boundaries
            replaceAll() : Replace all the matched sequence with this sequence
            replaceFirst : Replace the first matched sequence
      matches vs find
      Lookahead and Lookbehind: Split a string by keeping delimiters
       Split a string by the pipe symbol

No comments:

Post a Comment