1

This is the regular expression I use, but it doesn't match string "%test\n###Hello". Could anyone help what's wrong in my regular expression ? Thanks

private static Pattern REPL_PATTERN = Pattern.compile("%([\\w\\.]+).*");
zjffdu
  • 25,496
  • 45
  • 109
  • 159
  • 1
    It does not, due to the `.*` that only matches any number of chars *other than line break chars*. Use `Pattern.DOTALL` to make it match any char. Or `(?s)` embedded flag option (inline modifier). – Wiktor Stribiżew Oct 27 '17 at 08:00

0 Answers0