gatsbyz
gatsbyz

Reputation: 1075

What does the regular expression [.\d\D]* mean?

What does [.\\d\\D]* mean.

I am trying to check a valid java main method statement by

java.matches("[.\\d\\D]*((public)\\s(static)\\s(void)\\s(main)\\((String)\\[\\]\\s(args)\\))[.\\d\\D]*");

what does that part mean?

Upvotes: 1

Views: 9806

Answers (1)

anubhava
anubhava

Reputation: 785058

Well [.\d\D]* means match:

0 or more of anyone of these properties

  • digit
  • non-digit
  • literal dot

IMO this is not really required since this can effectively match anything and is equivalent of .* with DOTALL switch.

Upvotes: 4

Related Questions