setNewlineConvention

setNewlineConvention(newlineConvention: Integer): JadeRegexPattern;

The setNewlineConvention method of the JadeRegexPattern class specifies the character combination that represents a valid line‑ending character.

This fluent‑style method returns its own modified receiver, to allow call chaining. (By default, the carriage return, line feed, and carriage return line‑feed are all valid line‑ending conventions.)

This method enables you to run regular expression (Regex) searches across data with different line‑ending character sequences. It acts as an alternative to hard‑coding (*CR), (*CRLF), and so on within your pattern strings.

In a Regex pattern, \n always matches the new line (line‑feed) character and \r always matches the carriage return character. This cannot be changed by any options in PCRE2. (For details about PCRE2, see https://www.pcre.org/current/doc/html/pcre2syntax.html.)

The newlineConvention parameter values are listed in the following table.

Constant Integer Value
Newline_Any 128
Newline_AnyCrLf 160
Newline_Cr 32
Newline_CrLf 96
Newline_Lf 64

For details, see "JadeRegexPattern Class Constants", earlier in this chapter.

The default value is Newline_AnyCrLf; that is, the carriage return, line feed, and carriage return line‑feed characters are all valid line‑ending conventions.

2025.0.01 and higher