Given:
import java.util.regex.*; class Main {/*from w ww. j a va2 s . c om*/ public static void main(String [] args) { Pattern p = Pattern.compile(args[0]); Matcher m = p.matcher(args[1]); System.out.print("match positions: "); while(m.find()) { System.out.print(m.start() + " "); } System.out.println(""); } }
Which invocation(s) will produce the output: 0 2 4 8 ?
Choose all that apply.
B is correct.
Remember that the boundary metacharacters (\b and \B), act as though the string being searched is bounded with invisible, non-word characters.
Then remember that \B reports on boundaries between word to word or non-word to non-word characters.