Core Classes
About
1. Class: java.util.regex.Pattern
java.util.regex.PatternCommon Methods
Method
Description
Example:
Pattern pattern = Pattern.compile("\\d+");
Matcher matcher = pattern.matcher("Order 123 shipped on 2024-06-21");2. Class: java.util.regex.Matcher
java.util.regex.MatcherCommon Methods
Method
Description
Key Concepts
matches() vs find() vs lookingAt()
matches() vs find() vs lookingAt()Method
Description
Examples
1. Check Full Match
2. Find Substring Matches
3. Extract Groups
4. Replace All
3. Flags (Modifiers)
Flag
Constant
Purpose
Example:
4. Utility Methods using Regex (outside Matcher)
String.matches()
String.replaceAll()
String.split()
Common Use Cases in String Processing
Task
Method
Last updated