The String method in java which is used to match with a pattern is ______?
Answers
Answer:
macther() method is invoked using matcher object which interpretes pattern and performs match operations in the input string. 3. Object of which class is used to compile regular expression?
Explanation:
thanks
Answer:
Matcher method
Explanation:
The String method in java which is used to match with a pattern is Matcher method .
Matcher method-
1) It is used to match the pattern by this matcher.
2) This method do not accept any type of parameter .
3) In this method returns a pattern which is used to get the pattern matched by this matcher.
Example of java-
Example 1:
// Java code to illustrate pattern() method
import java.util.regex.*;
public class GFG {
public static void main(String[] args)
{
// Get the regex to be checked
String regex = "Geeks";
// Create a pattern from regex
Pattern pattern
= Pattern.compile(regex);
so this is the example of java by matcher method and this method is very helpful from which we know that how to match the pattern and can know which is one match.
This method is very helpful in everything and pattern can be matched by this method and sign of this is () .
FINAL ANSWER -The String method in java which is used to match with a pattern is Matcher method .
#SPJ3