| Pattern in source code | string literal — every \ doubled: "\\d+" | /\d+/ literal, single backslashes |
| Whole-string match | s.matches(re) / matcher.matches() — implicitly anchored | needs explicit ^…$ |
| Find anywhere | matcher.find() | default behavior of .test() / .exec() |
| Named capture groups | (?<name>…), group("name") — Java 7+ | (?<name>…) — identical |
| Case-insensitive | Pattern.CASE_INSENSITIVE or inline (?i) | /i flag |
| Dot matches newline | Pattern.DOTALL or inline (?s) | /s flag |
| Multiline anchors | Pattern.MULTILINE or inline (?m) | /m flag |
| Possessive quantifiers | a++, a*+ supported | not supported |
| Free-spacing comments | Pattern.COMMENTS or inline (?x) | not supported |