(1)
The ‘$’ present in the RegExp object is called a ____________
Answer: metacharacter
Answer: metacharacter
var text = "testing: 1, 2, 3"; var pattern = /\d+/g;
Answer: pattern.test(text)
Answer: [^…]
Answer: Match zero or more characters that are not open parenthesis
Answer: Matches the letter b preceded by the fewest number of a’s possible
Answer: It matches “java” followed by the optional “script”
Answer: Define subpatterns within the complete pattern
Answer: replace()
Answer: Returns [“123″,”456″,”789”]
var pattern = /Java/g; var text = "JavaScript is more fun than Java!"; var result; while ((result = pattern.exec(text)) != null) { alert("Matched '" + result[0] + "'" +" at position " + result.index +"; next search begins at " + pattern.lastIndex); }
Answer: Returns the same kind of array whether or not the regular expression has the global g flag
System.out.println(Pattern.matches("[amn]", "abcd"));
Answer: false
System.out.println(Pattern.matches("[amn]?", "a"));
Answer: true
System.out.println(Pattern.matches("\\d", "1"));
Answer: true
System.out.println(Pattern.matches("[adf]+", "a"));
Answer: true
System.out.println(Pattern.matches("[^abc]", "aemngq"));
Answer: false