What is the result?

Given:

What is the result?

Given:

What is the result?

A.
Pastel
Enamel
Fresco
Gouache

B.
Pastel
*Enamel
Fresco
*Gouache

C.
Pastel
Enamel
Fresco
Gouache

D.
Pastel
Enamel, Fresco
Gouache

Explanation:

regex

, = ,
\ = masks the following
\s = A whitespace character: [ \t \n \x0B \f \r ]
* = Greedy Quantifier: zero or more times
Delimiter: comma + zero or more whitespace characters



Leave a Reply 5

Your email address will not be published. Required fields are marked *


Humberto Bañuelos Flores

Humberto Bañuelos Flores

public static void main(String[] args) {
String input = “Pastel, *Enamel, *Fresco, *Gouacge”;
Scanner s = new Scanner(input);
s.useDelimiter(“,\\s\\*”);
while (s.hasNext()) {
System.out.println(s.next());
}
}