Skip to content

Commit

Permalink
8296292: Document the default behavior of '$' in regular expressions …
Browse files Browse the repository at this point in the history
…correctly

Reviewed-by: lancea
  • Loading branch information
rgiulietti committed Nov 17, 2022
1 parent d8c809b commit 35acb89
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/java.base/share/classes/java/util/regex/Pattern.java
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,15 @@
* <p> The regular expression {@code .} matches any character except a line
* terminator unless the {@link #DOTALL} flag is specified.
*
* <p> By default, the regular expressions {@code ^} and {@code $} ignore
* line terminators and only match at the beginning and the end, respectively,
* of the entire input sequence. If {@link #MULTILINE} mode is activated then
* <p> If {@link #MULTILINE} mode is not activated, the regular expression
* {@code ^} ignores line terminators and only matches at the beginning of
* the entire input sequence. The regular expression {@code $} matches at the
* end of the entire input sequence, but also matches just before the last line
* terminator if this is not followed by any other input character. Other line
* terminators are ignored, including the last one if it is followed by other
* input characters.
*
* <p> If {@link #MULTILINE} mode is activated then
* {@code ^} matches at the beginning of input and after any line terminator
* except at the end of input. When in {@link #MULTILINE} mode {@code $}
* matches just before a line terminator or the end of the input sequence.
Expand Down

0 comments on commit 35acb89

Please sign in to comment.