Which method is used to search for a match in a string?exec()test()compile()split()PreviousSave & Next
Question
Which method is used to search for a match in a string?exec()test()compile()split()PreviousSave & Next
Solution
The method used to search for a match in a string is test(). This method is used in JavaScript and it searches a string for a specified value. It returns true if it finds a match, otherwise it returns false.
Similar Questions
Which method is used to compile a regular expression?exec()test()compile()split()PreviousSave & Next
Which method is used to replace a pattern in a string?search()replace()match()split()PreviousSave & Next
Which of these method of class String is used to check whether a given object starts with a particular string literal?
Predict the output of the below code :import java.util.regex.*; public class TestRegEx{ public static void main(String args[]) { Pattern p = Pattern.compile(".ech"); Matcher m = p.matcher("tech"); boolean b = m.matches(); System.out.println(b); }}Select one:a.compile time errorb.falsec.Runtime Errord.trueClear my choice
Which method is used to find a substring within a string in C++?find()substr()search()locate()
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.